How do I get usb storage with ext4 writeable as user?

Started by vilde, 2015/02/12, 10:18:16

Previous topic - Next topic

vilde

"Normal" usb hard disks have windowz filesystems I think, when they are mounted they are write able as user. If I format a usb external hard disk with ext4 it will not be write able as user.

I would like my external ext4 disk to be user write able automatic on my computers, how?

towo

Ich gehe nicht zum Karneval, ich verleihe nur manchmal mein Gesicht.

vilde

Quote from: towo on 2015/02/12, 10:21:28
man chmod
man chown
Yes, but if I understand right, this commands can make my hard disk write able as user when it's mounted, but I want it to work automatic as it does with the external disks with windowz filesystems.

devil

You did not say that clear enough. What DE are you using?


greetz
devil

vilde


towo

Quotebut I want it to work automatic as it does with the external disks with windowz filesystems.
This will never work since linux-fs' using linux-rights!
There is no way to give the needed rights with magical mount-options!
Ich gehe nicht zum Karneval, ich verleihe nur manchmal mein Gesicht.

gerd

Quote from: towo on 2015/02/12, 12:54:19
Quotebut I want it to work automatic as it does with the external disks with windowz filesystems.
This will never work since linux-fs' using linux-rights!
There is no way to give the needed rights with magical mount-options!

Serious question: Why not? There is somewhere a auto-mount logic that executes a mount if a usb device is plugged in.
There are mount options and fstab options to make a single device writeable for all users so why shouldn't be there a way to add such an option to default mount options for generic new devices

Here is such one solution with udev (untested, only as example that there are/should be ways)
http://unix.stackexchange.com/questions/111685/usb-drive-permissions-when-automounting/124060#124060

edit: After reading many boards i don't see a way to reach this wis udisks (used by XFCE and most other DEs). So a manual chmod/chuser stays as annoying workaround.

towo

There are mount options and fstab options to make a single device writeable for all users so why
No, there isn't because such mount options are only available on non linux fs.
Ich gehe nicht zum Karneval, ich verleihe nur manchmal mein Gesicht.

dibl

The great advantage that the Universal Serial Bus brought to computer users is hot-pluggability. Methods that I have tried to "permanently" mount a USB device have always led to regrets.  For example, you THINK you always want it connected, then one day you need to use it somewhere else, and if you put the "auto" option on a mount command in /etc/fstab, your computer might not boot at all.

I recommend that (as root) make a directory on the USB drive and set the permissions for all users to have access to it.  Or make a folder for each user on it.  But leave the device itself a root-owned device.
System76 Oryx Pro, Intel Core i7-11800H, ASRock B860 Pro-A, Intel Core Ultra 7 265KF, Nvidia GTX-1060, SSD 990 EVO Plus.

vilde

Thank you Towo for explaining.

Quote from: dibl on 2015/02/12, 14:43:02
.................................
I recommend that (as root) make a directory on the USB drive and set the permissions for all users to have access to it.  Or make a folder for each user on it.  But leave the device itself a root-owned device.

@ dibl, that will work good enough for me, thanks

reinob

Quote from: towo on 2015/02/12, 14:39:00
There are mount options and fstab options to make a single device writeable for all users so why
No, there isn't because such mount options are only available on non linux fs.

I guess the only way to achieve this would be mounting ext3/4 via fuse. Some time ago I tried to set-up a partition which would be R/W for a group no matter how things got copied/moved in there (tried with directory-setuid bit, ACLs, you-name-it). In the end the only "reliable" option was FAT32. If fuse-ext4 exists it might provide a solution.

vilde

I tried the solution that dibl suggested, it's working very well and is so simple that I feel stupid not finding it out myself. I (as root) made a directory named USERS on the usb-disk and made it write and read able for everybody. No need to hassle around with some complicated (and troublesome) solutions for my needs.

One reason that I didn't found out that solution myself is that I'm to bad in understanding how file-rights work. The directory is marked as read and write able for everybody and that will now be so on every linux system I use the usb-disk on, I had some "weird" thought that the file-rights was connected to one computer or installation, but it's not.

One question, if I do a directory on the usb-disk with only rights for a specific user, will it work for a user with the same name on another computer or installation then?

musca

Hello dibl,

Quote from: dibl on 2015/02/12, 14:43:02
and if you put the "auto" option on a mount command in /etc/fstab, your computer might not boot at all
That's right. systemd.mount assumes that boot should fail if mounting doesn't succeed.

But luckily with the mount option "nofail" you can mark such additional mounts as not essential.

greetings
musca
,,Es irrt der Mensch, solang er strebt."  (Goethe, Faust)

musca

hello vilde,

the name of your user is only displayed for humans.

Internally the user is referenced by his UID which is assigned in /etc/passwd.
On other systems your files will belong to the user with the same UID.

You may want to try
id "$USER"

greetings
musca
,,Es irrt der Mensch, solang er strebt."  (Goethe, Faust)

dibl

Quote from: musca on 2015/02/12, 19:30:00

But luckily with the mount option "nofail" you can mark such additional mounts as not essential.


Thanks -- I did not even know about that option.  Good to learn new things here on the forum.   :)
System76 Oryx Pro, Intel Core i7-11800H, ASRock B860 Pro-A, Intel Core Ultra 7 265KF, Nvidia GTX-1060, SSD 990 EVO Plus.