Skip to contentSkip to conversation

mount: what is the point of 'nouser' on the command line?

DISCUSSION Benno Schulenberg 2 participants 6 messages Jul 14, 2014 – Jul 15, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Hi all,

The man page of mount(8) currently contains the following example to show how the -o option can be used:

mount LABEL=mydisk -o noatime,nouser

As the command does not contain a mountpoint, it requires an entry in fstab in order to work. If that entry does not contain the keyword 'user' in the options field, then the mount will effectively already be 'nouser'. If it does contain the keyword 'user', does specifying 'nouser' then somehow exclude other users? As far as I can tell it doesn't.

So, is it ever useful to specify '-o nouser' on the command line?

Something else. On the man page of umount, shouldn't it say that the -O and -t options are only effective in combination with -a?

Further, mount recognizes the options -L and -U besides the keywords LABEL= and UUID=, but umount only recognizes the latter two. For symmetry it would be nice if umount also recognized -L and -U.

Benno

Signature · 1 line
http://www.fastmail.fm - Access your email from home and the web
maintainer
#1 lore raw
Quoted 11 lines · Benno Schulenberg

The man page of mount(8) currently contains the following example to show how the -o option can be used:

mount LABEL=mydisk -o noatime,nouser

As the command does not contain a mountpoint, it requires an entry in fstab in order to work. If that entry does not contain the keyword 'user' in the options field, then the mount will effectively already be 'nouser'. If it does contain the keyword 'user', does specifying 'nouser' then somehow exclude other users? As far as I can tell it doesn't.

It does not exclude others users. The idea of the "no*" options is disable previously applied flags. The options from command line are evaluated after options from fstab, so for example "foo,bar" (fstab) and "nofoo" (command line) means that "nofoo" negate the previous "foo".

The "user" option is alias to "noexec,nosuid,nodev" mount flags.

I'm not sure why, but "nouser" has never been implemented. So it does not have any effect and "user" from fstab is still applied -- maybe to avoid possible security bugs or so.

Quoted 1 line

So, is it ever useful to specify '-o nouser' on the command line?

No, it would be better to remove it from the example and add to the man page note that "nouser" has no any effect and you have to explicitly use "exec,suid,dev" to negate.

Quoted 2 lines

Something else. On the man page of umount, shouldn't it say that the -O and -t options are only effective in combination with -a?

The -t is generic and it's usable in more case (for example to specify filesystem that should be tried for the device).

The -O is really usable for -a only.

Quoted 3 lines

Further, mount recognizes the options -L and -U besides the keywords LABEL= and UUID=, but umount only recognizes the latter two. For symmetry it would be nice if umount also recognized -L and -U.

I think -L and -U are mistakes maintained for backward compatibility, because TAG=value is more generic and extendable syntax. For example now we also supports PARTUUID= and PARTLABEL=.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#2 lore raw
Quoted 1 line · Karel Zak

The "user" option is alias to "noexec,nosuid,nodev" mount flags.

Ehm... Not quite. It *implies* those options, to lightly protect the user from some dangers, but its main purpose is to allow ordinary users to mount the filesystem so marked in fstab. No?

Quoted 3 lines
Quoted 1 line

So, is it ever useful to specify '-o nouser' on the command line?

No, it would be better to remove it from the example

Will submit a patch later.

Quoted 5 lines
Quoted 2 lines

Something else. On the man page of umount, shouldn't it say that the -O and -t options are only effective in combination with -a?

The -t is generic and it's usable in more case (for example to specify filesystem that should be tried for the device).

Ehm... I was talking about umount here, not mount. :)

Benno

Signature · 1 line
http://www.fastmail.fm - A no graphics, no pop-ups email service
maintainer
#3 lore raw
Quoted 7 lines · Benno Schulenberg
Quoted 1 line · Karel Zak

The "user" option is alias to "noexec,nosuid,nodev" mount flags.

Ehm... Not quite. It *implies* those options, to lightly protect the user from some dangers, but its main purpose is to allow ordinary users to mount the filesystem so marked in fstab. No?

Sure, I have talked about the options and how the options are evaluated.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

So, is it ever useful to specify '-o nouser' on the command line?

No, it would be better to remove it from the example

Will submit a patch later.

Thanks.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Something else. On the man page of umount, shouldn't it say that the -O and -t options are only effective in combination with -a?

The -t is generic and it's usable in more case (for example to specify filesystem that should be tried for the device).

Ehm... I was talking about umount here, not mount. :)

Oh... sorry :-) Anyway, it's the same, the "-t" is usable without -a too.

    umount -a -t <type, ...>

the <type> is interpreted as pattern.

umount -t <type>

the <type> is filesystem type (so you can force umount to use for example /sbin/umount.<type>).

The -O is usable with -a only.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#4 lore raw

umount: --types does not limit

Quoted 4 lines · Karel Zak

umount -t <type>

the <type> is filesystem type (so you can force umount to use for example /sbin/umount.<type>).

Hmm. But it's not working for me, the --types option does not limit umount in any way. In the man page it says: "Indicate that the actions should *only* be taken on filesystems of the specified type."

But, for example, here Suse is of type ext4 and gets mounted:

# ./mount -t ext4 /suse
# ./mount | grep suse
/dev/sda2 on /suse type ext4 (rw,noatime,noexec,nosuid,nodev,user)

Now I want to unmount all btrfs systems:

# ./umount -t btrfs /suse /zero /other
# ./mount | grep suse

It just unmounts everything that is mentioned, the -t has no limiting effect. So it is useful only with -a.

Benno

Signature · 2 lines
http://www.fastmail.fm - Faster than the air-speed velocity of an
                          unladen european swallow
maintainer
#5 lore raw

Re: umount: --types does not limit

Quoted 17 lines · Benno Schulenberg
Quoted 4 lines · Karel Zak

umount -t <type>

the <type> is filesystem type (so you can force umount to use for example /sbin/umount.<type>).

Hmm. But it's not working for me, the --types option does not limit umount in any way. In the man page it says: "Indicate that the actions should *only* be taken on filesystems of the specified type."

But, for example, here Suse is of type ext4 and gets mounted:

# ./mount -t ext4 /suse
# ./mount | grep suse
/dev/sda2 on /suse type ext4 (rw,noatime,noexec,nosuid,nodev,user)
Quoted 7 lines

Now I want to unmount all btrfs systems:

# ./umount -t btrfs /suse /zero /other
# ./mount | grep suse

It just unmounts everything that is mentioned, the -t has no limiting effect. So it is useful only with -a.

grrr... you're right, I see.. libmount always overwrites the setting by stuff from mtab.

IMHO it would be nice to restrict the all the umount actions (like --recursive, --all-targets or when more mountpoints specified) by the pattern. I'll add this to the TODO file for v2.26.

Thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com