2

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.

  • 3
    You can use ext4 on your pendrive. The only problem is that only linux systems will be able to see it. But it really makes no sense to use a fs with a journal on a pen drive. You can have e.g. ext2. – Pilot6 Aug 13 '19 at 09:18
  • 1
    And what is the question? Go ahead and use whatever filesystem on your pen drive. – Pilot6 Aug 13 '19 at 09:19
  • Forget Windows is my primary goal. This is written in the question. Is is possible with ext4? I suppouse not. I want only a network with linux in my company! I don't want to use NTFS and Fat32. I know that Windows neddds to have an app to read ext4. – Gian Luca Brizi Aug 13 '19 at 09:24
  • "But it really makes no sense to use a fs with a journal on a pen drive." Read please I wrote: "or USB box". It means 2TB hard drive in the box! Can I use in my network ONLY linux and ONLY extx partitions without NTFS and FAT32? I want to take away a 2TB at home and read it with my Ubuntu Laptop. – Gian Luca Brizi Aug 13 '19 at 09:27
  • 1
    It IS possible to use ext4 on a pen drive, why not? Just format it to ext4. Notheing else to be done. – Pilot6 Aug 13 '19 at 09:27
  • What is "USB Box"? – Pilot6 Aug 13 '19 at 09:28
  • No Pilot6, Gparted writes the owner's UID number and the group's GID number. If I make the partition with Root for Gparted, after five minutes I reconnect the USB drive the normal user will not use it!! I need chown help. I need chmod help! Then If I take the 2TB drive away I have to reset all again!! – Gian Luca Brizi Aug 13 '19 at 09:31
  • Pilot! USB box enclosure with drive inside! You can insert hard drive into it, this question is for all mass storage devices! – Gian Luca Brizi Aug 13 '19 at 09:32
  • If you simply format a partition to ext4, it won't have restrictions on it. You can always mount it on any other system. – Pilot6 Aug 13 '19 at 09:34
  • You can use chown and chmod at the file-system's level / the mountpoint, or at the directory level or the file level (specific for individual files if you wish). Do you need help with those commands? I suggest that you use them with sudo until you have the desired ownership and permissions to get the access that you want to directories and files. – sudodus Aug 13 '19 at 11:59
  • First you should check very carefully the actual path to the mountpoint of your ext file system in the USB drive.Then I suggest that you try this command line, which will give full access for 'everybody' to 'everything' in that file system, sudo chmod -R ugo+rwx /path/to/mountpoint – sudodus Aug 13 '19 at 12:12

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
  • 26,947
  • LINUX only linux, I want to forget windows in my mind. I use linux in all my infrastructure. The Askubuntu is full of expanded command lines, this is a simple question that demonstrates how the linux world is made too mutch complicated. The answer you offered is near the truth! – Gian Luca Brizi Aug 14 '19 at 13:06
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.