6

I'm not sure why mount is installed with SUID bit on many distributions.

In graphical environment, it doesn't require user to type the mount command to mount a partition. Normally udisks will communicate with another daemon to mount the drive.

And on a server, I don't see the necessity as well.

So, is there any reason to have SUID bit set?

15

mount() requires root (or CAP_SYS_ADMIN on Linux), but it is possible to specify a mountpoint in /etc/fstab that is allowed to be mounted by a user by using the users option. To facilitate this, they need to elevate to the superuser account to be able to execute mount() successfully.

0

It will depend on the options used when the drives are mounted.

Have a look at /etc/fstab, if the entry for the partitions in question has defaults set as an option then this implies that suid is set, from man mount[1]...

defaults
              Use default options: rw, suid, dev, exec, auto, nouser, and async.

You can over-ride this by specifying alternative options in /etc/fstab, for example you can specify users as an option (although I was caught out by the fact that this implies noexec so I couldn't run any scripts and had to over-ride this), so have this in my /etc/fstab:

LABEL=home      /home       ext4    noatime,users,exec  0 4

[1] I was reading man mount and man fstab yesterday after having a problem with default options myself.

2
  • 2
    As far as I can tell, the question is about the mount binary having the setuid bit set, not about allowing suid files on the mounted filesystem, which is what the suid option does. – Chris Down Jan 2 '14 at 8:58
  • I agree, and your post (which was made whilst I was typing out mine) answers this directly (and is a depth of knowledge I don't have). I thought that what I wrote would be useful to leave up as it provides some sort of practical work around (including the same solution of adding users in /etc/fstab but also highlights something which bit me yesterday which was the default options that users implies prevent execution and can over-ridden with exec). Happy for it to be deleted though. – slackline Jan 2 '14 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.