[SOLVED] Can't unmount NFS as normal user after hardware and Slackware upgrade
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can't unmount NFS as normal user after hardware and Slackware upgrade
Recently upgraded hardware and did a full installation of Slackware 15.
I'm using a network file server with the same settings as I was with Slackware 14.2, which functions the same as before except that now I can only unmount it as root. I can mount it as a normal user as I could before; but if I try to unmount it as a normal user I get the error message
Code:
umount.nfs: You are not permitted to unmount /media/pinotgrigio_server
If you mount NFS with the "user" option, the user who mounted it will be written to /run/mount/utab
Mount specifications are written in /etc/mtab by the kernel¹ (and there is no "user" information).
When umounting NFS, the content of /etc/fstab is irrelevant
The information needed is in /etc/mtab (/proc/mounts) and /run/mount/utab
And regular users are not allowed to write inside /etc/mtab
It's probably a bit simplistic, but I couldn't find the detailed information in which it was explained
The practical result is that there is no fix that I am aware of. As explained in the above thread, the altered behaviour is a consequence of the way the "users" option is tracked in the case of NFS mounts, and the switch of /etc/mtab from a file (which "mount" could write directly) to a symlink pointing to /proc/mounts (which "mount" has no control over).
The workaround I ultimately adopted was the use of sudo with the appropriate umount command.
Even though it's a private subnet, above, I chose arbitrary username, subnet, uid and gid, for illustartive purposes, because I'm not expert enough on security to know if leaking such info could be exploited.
However, since user's shared home directory is what the user logs in to when accessing these remote machines over ssh, I can't test unmounting as regular user, because the directory is in use. But I can say that before I explicitly defined uid and gid, my user couldn't write, even though I had rw specified.
the altered behaviour is a consequence of the way the "users" option is tracked in the case of NFS mounts, and the switch of /etc/mtab from a file (which "mount" could write directly) to a symlink pointing to /proc/mounts (which "mount" has no control over).
If you remove the symbolic link /etc/mtab, rc.S will make it a file. Or if you have an old install like I have, there has never been a link, so it still is a file.
You could always configure the automounter instead.
True, in some situations. In my case the automounter could not be used because the volume being mounted was not always available and this caused other issues. For many others though it could be a viable solution. It really depends on why ordinary users - as opposed to the system - need to do the mount/umount in each specific situation.
If you remove the symbolic link /etc/mtab, rc.S will make it a file. Or if you have an old install like I have, there has never been a link, so it still is a file.
Forcing /etc/mtab back to a file is certainly an option. However, there are good reasons why /etc/mtab was changed to a symlink in (from what I've heard) pretty much all distributions (with Slackware being one of the last I think). Among other things, it makes the use of a read-only root filesystem easier and I believe the symlink also simplifies the use of namespaces. If none of the related issues are of concern or relevant, shifting /etc/mtab back to a file could work. However, since most distributions and packages are now assuming /etc/mtab is a symlink to /proc/mounts, there may come a time where a /etc/mtab file causes trouble. This was the primary reason I stuck with the symlink and came up with a solution which worked in my situation: it will prevent things breaking unexpectedly at some point in the future when it won't be possible to quickly get things going again by reverting to a file while a fix is devised.
Thanks everybody for your suggestions, Ive looked where I'd never have otherwise thought of.
It looks like the easiest way for me is to keep unmounting as root, all the alternatives carry the risk of unexpected consequences some random time in the future. On the plus side, I've learned quite a bit.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.