3

My goal is to have a USB drive in ext4 and to use it as a normal Fat32/NTFS pendrive (or usb box drive). I would be happy to forget NTFS and Fat32 and to use this USB Drive with all pc in my local net. By the use of CHMOD and CHOWN I would create a REALLY everyone drive in ext4. Every mountpoint should be for everyone. Tons of command line rows are written but no tutorial and simple procedures to make it possible. Thanks.

Gian Luca Brizi
  • 31
  • 1
  • 1
  • 5

2 Answers2

2

If you want an owner/group-agnostic file system for your drive, ext3/ext4 is not the right one for you.

Only filesystems which do not support Linux permissions like fat have an attribute for ownership/groupship: uid=value and gid=value. See the manual page on mount. (via)

As a workaround you could use a bind mount if you have sudo, but that is probably not what you want:

sudo bindfs -u $(id -u) -g $(id -g) /media/diskFoo ~/myUIDdiskFoo

(via)

I don't know of any suitable unix/linux/opensource permission-agnostic file system. Unfortunately, you should probably use exFat (NTFS is a journalling fs and thus not suitable for flash storage).


Update: I just read about F2FS - "Flash Friendly File System", but I don't have any experience with it and it seems to have a normal unix permission model.

pLumo
  • 27,991
0

A solution that gives default permissions to all, also for newly created files, is with a default access control list.

It is described for full in this unix.stackexchange answer -- the short parts:

mkfs.ext4 /dev/<device>
tune2fs -o acl /dev/<device>
mount /dev/<device> /mnt/<mountpoint>
chown <username>:<groupname> /mnt/<mountpoint> # Optional; try to use the name of the user who is most commonly using this filesystem
chmod 777 /mnt/<mountpoint>
setfacl -m d:u::rwx,d:g::rwx,d:o::rwx /mnt/<mountpoint>
umount /mnt/<mountpoint>

Problems might occur if you copy files with their set attributes; permissions might be preserved and other users might not edit or overwrite the files (but usually still read). But since the upper level directories are world-writeable, any user can rename or delete the files (and thus (via copying) also create new files owned by oneself and set permissions to 777). See the above mentioned stackexchange answer.