You are not logged in.

#1 2020-09-26 12:14:43

ktatar156
Member
Registered: 2012-10-01
Posts: 79

Automount with rw USB drive ext4

Hello,

I'm having a problem - when I connect USB hard drive formatted as EXT4, it mounts automatically only as read only for normal users.... Only as root I can write to it. I'm using KDE (dolphin), my user is a member of groups: wheel, disk, storage.

When USB key is formatted as NTFS - everything works normally and in default I can write to it.

Could anyone help me? smile

Offline

#2 2020-09-26 12:22:33

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,365

Re: Automount with rw USB drive ext4

On an ext4 file system the permissions are stored on the filesystem. You need to chown the directory you intend to write to after mounting to the users/groups you intend to have write access to.

Not an Application issue, moving to  NC

Last edited by V1del (2020-09-26 12:23:29)

Offline

#3 2020-09-26 12:27:05

ktatar156
Member
Registered: 2012-10-01
Posts: 79

Re: Automount with rw USB drive ext4

Thanks for fast reply! For me, it doesn't make sens - why NTFS drive automatically can be mounted as rw, but EXT4 not? smile Is there a possibility to set some option as: "automount all drives with rw permissions for normal desktop users"?

Offline

#4 2020-09-26 12:34:22

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: Automount with rw USB drive ext4

Is it actually mounting read-only, as in the "ro" mount option? If not, re-read wht V1del told you. You're dealing with POSIX permissions, and there's a whole lot of info available about that.

Last edited by Scimmia (2020-09-26 12:35:31)

Offline

#5 2020-09-26 12:37:37

ktatar156
Member
Registered: 2012-10-01
Posts: 79

Re: Automount with rw USB drive ext4

It automounts rw only for root user, other users can only read.

Offline

#6 2020-09-26 12:40:42

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: Automount with rw USB drive ext4

You don't get it. Mount options aren't set per user. If it's mounted rw, it's rw, full stop. Everything else is POSIX permissions (and ACLs/capabilities and other similar things, but that isn't the issue here).

Last edited by Scimmia (2020-09-26 12:42:17)

Offline

#7 2020-09-26 12:43:35

ktatar156
Member
Registered: 2012-10-01
Posts: 79

Re: Automount with rw USB drive ext4

Ok, I understand - so how I can set that normal users would be allowed to write by default?

Offline

#8 2020-09-26 12:44:12

loqs
Member
Registered: 2014-03-06
Posts: 19,043

Re: Automount with rw USB drive ext4

mount
....
/dev/sda2 on /boot type ext4 (rw,relatime)

The rw means mounted rw.  That applies to allowed operations on that filesystem and has no connection to users.

V1del wrote:

You need to chown the directory you intend to write to after mounting to the users/groups you intend to have write access to.

See also man 1 chown.

Last edited by loqs (2020-09-26 12:45:36)

Offline

#9 2020-09-26 12:45:42

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: Automount with rw USB drive ext4

ktatar156 wrote:

Ok, I understand - so how I can set that normal users would be allowed to write by default?

V1del wrote:

You need to chown the directory you intend to write

edit: too slow, by 8 seconds.

Last edited by Trilby (2020-09-26 12:46:07)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#10 2020-09-26 12:46:03

euromatlox
Member
Registered: 2017-02-10
Posts: 153

Re: Automount with rw USB drive ext4

I would stick with FAT32 or EXFAT for those USB sticks and cards to use for read/write in any file system. I noticed that EXFAT does not automount, but appears to desktop (xfce), where I can easily mount it right-clicking the mouse. Full rw access for both filesystems. For EXFAT the following package is needed.

pacman -S exfat-utils

And to be sure that data truly is written, before ejecting the stick/card, remember command

sync

Last edited by euromatlox (2020-09-26 12:51:01)

Offline

#11 2020-09-26 12:48:23

ktatar156
Member
Registered: 2012-10-01
Posts: 79

Re: Automount with rw USB drive ext4

loqs wrote:
mount
....
/dev/sda2 on /boot type ext4 (rw,relatime)

The rw means mounted rw.  That applies to allowed operations on that filesystem and has no connection to users.

V1del wrote:

You need to chown the directory you intend to write to after mounting to the users/groups you intend to have write access to.

See also man 1 chown.

Yes, that's correct, but I need to chown every new disk when I connect it first time I assume... I would like to chown automatically every new disk by default to 'storage' group.

Offline

#12 2020-09-26 12:49:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: Automount with rw USB drive ext4

https://wiki.archlinux.org/index.php/Ud … udev_rules

Make some effort to find answers to your own (follow-up) questions.  Do not expect to be spoon fed every step of the way.

But also be aware of the side-effects of what you are proposing.  If these drives are only for use on the computer you are currently using, this should never have been a problem: you would create them with the permissions you'd want in the first place.  Your goal of wanting to automate the chown suggests this is regular enough that you must be getting flash drives from other sources.  If you chown to group on your current computer, the content will then not be writable by other systems (unless they have a group with the same gid).

Last edited by Trilby (2020-09-26 12:52:02)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB