So today I learned something about mount
: There’s a not well known feature of it, which allows specifying in fstab
a bind mount with the users
option, and this allows non root users to mount a directory on demand, without root permissions. Here’s where I learned it:
It appears (according to this discussion that mount
needs to have these permissions in order to allow this feature:
-rwsr-xr-x 1 root root 66944 Aug 12 23:14 mount
The mount
in the /nix/store doesn’t have these permissions (naturally). Therefor it is incapable of performing this operation. It can be verified if one runs:
cp $(readlink --canonicalize $(where mount)) ./
sudo chown root:root ./mount
sudo chmod u+ws ./mount
And then tries to run ./mount /local/dir
vs mount /local/dir
.
I’d like to write PR that will make utillinux
set this permission to the mount
executable. A glance at:
$ find -L /run/current-system/sw/bin -perm -4000
/run/current-system/sw/bin/unix_chkpwd
Suggests that this is the only executable we do set these permissions ? But I couldn’t find where it came from.