Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] How do I get usb storage with ext4 writeable as user?  (Read 8792 times)

Offline vilde

  • User
  • Posts: 708
[EN] How do I get usb storage with ext4 writeable as user?
« on: 2015/02/12, 10:18:16 »
"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?

Online towo

  • Administrator
  • User
  • *****
  • Posts: 2.938
Re: How do I get usb storage with ext4 writeable as user?
« Reply #1 on: 2015/02/12, 10:21:28 »
man chmod
man chown
Ich gehe nicht zum Karneval, ich verleihe nur manchmal mein Gesicht.

Offline vilde

  • User
  • Posts: 708
Re: How do I get usb storage with ext4 writeable as user?
« Reply #2 on: 2015/02/12, 10:31:50 »
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.

Offline devil

  • Administrator
  • User
  • *****
  • Posts: 4.842
Re: How do I get usb storage with ext4 writeable as user?
« Reply #3 on: 2015/02/12, 11:36:41 »
You did not say that clear enough. What DE are you using?


greetz
devil

Offline vilde

  • User
  • Posts: 708
Re: How do I get usb storage with ext4 writeable as user?
« Reply #4 on: 2015/02/12, 11:56:48 »
XFCE

Online towo

  • Administrator
  • User
  • *****
  • Posts: 2.938
Re: How do I get usb storage with ext4 writeable as user?
« Reply #5 on: 2015/02/12, 12:54:19 »
Quote
but 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.

Offline gerd

  • User
  • Posts: 147
Re: How do I get usb storage with ext4 writeable as user?
« Reply #6 on: 2015/02/12, 14:27:45 »
Quote
but 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.
« Last Edit: 2015/02/12, 14:41:28 by gerd »

Online towo

  • Administrator
  • User
  • *****
  • Posts: 2.938
Re: How do I get usb storage with ext4 writeable as user?
« Reply #7 on: 2015/02/12, 14:39:00 »
Code: [Select]
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.

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
Re: How do I get usb storage with ext4 writeable as user?
« Reply #8 on: 2015/02/12, 14:43:02 »
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, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO

Offline vilde

  • User
  • Posts: 708
Re: How do I get usb storage with ext4 writeable as user?
« Reply #9 on: 2015/02/12, 15:04:23 »
Thank you Towo for explaining.

.................................
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

  • Guest
Re: How do I get usb storage with ext4 writeable as user?
« Reply #10 on: 2015/02/12, 16:43:59 »
Code: [Select]
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.

Offline vilde

  • User
  • Posts: 708
Re: How do I get usb storage with ext4 writeable as user?
« Reply #11 on: 2015/02/12, 17:23:02 »
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?
« Last Edit: 2015/02/12, 17:32:07 by vilde »

Offline musca

  • User
  • Posts: 725
  • sid, fly high!
Re: How do I get usb storage with ext4 writeable as user?
« Reply #12 on: 2015/02/12, 19:30:00 »
Hello dibl,

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)

Offline musca

  • User
  • Posts: 725
  • sid, fly high!
Re: How do I get usb storage with ext4 writeable as user?
« Reply #13 on: 2015/02/12, 19:36:09 »
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
Code: [Select]
id "$USER"
greetings
musca
„Es irrt der Mensch, solang er strebt.“  (Goethe, Faust)

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
Re: How do I get usb storage with ext4 writeable as user?
« Reply #14 on: 2015/02/12, 23:36:06 »

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, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO