Re: user mounting a filesystem; was Re: ld.so.nohwcap and ld.so.preload; was Re: mounting a labeled filesystem.
Hi.
On Thu, 26 Feb 2015 07:23:10 -0800
peter@easthope.ca wrote:
> From: Reco <recoverym4n@gmail.com>
> Date: Thu, 26 Feb 2015 09:31:14 +0300
> > In that case a correct way of doing this is:
> >
> > mount -v LABEL=GRNSDHC41
>
> Output is independent of the -v option.
>
> peter@dalton:~$ mount -v -t ext2 LABEL=GRNSDHC41
> mount: only root can do that
> peter@dalton:~$ mount -t ext2 LABEL=GRNSDHC41
> mount: only root can do that
And that means 'close, but no cookie'.
Get your hands on util-linux source. Wheezy's one, to be specific - [1].
util-linux-2.20.1/mount/mount.c has this wonderful snippet at line 2621:
if (restricted &&
(types || options || readwrite || nomtab || mount_all ||
nocanonicalize || fake || mounttype ||
(argc + specseen) != 1)) {
if (ruid == 0 && euid != 0)
/* user is root, but setuid to non-root */
die (EX_USAGE, _("mount: only root can do that "
"(effective UID is %u)"), euid);
die (EX_USAGE, _("mount: only root can do that"));
}
Translating this into plain English - there're arguments for mount
executable that are expected to work only if you're root. Those are
'restricted' ones. Filesystem type ('-t', types in source) is one of
these 'restricted' options.
So, your options to solving the problem are:
1) Patch out a check for the filesystem type.
It seems like a bad idea to me - such options are checked for a reason,
after all, but the patch itself is trivial.
2) Use good old automount(8) for your mounting needs.
3) Use whatever shiny new thing FreeDesktop thinks is best today. A
current one should be called udisks2, but don't trust me on this.
4) Use systemd. It definitely has some kind of automounting facility.
[1]
http://ftp.de.debian.org/debian/pool/main/u/util-linux/util-linux_2.20.1.orig.tar.gz
Reco
Reply to: