Subject: bug#39670: Cannot mount NFS share as user or root

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 12 Oct 2020 23:22:36 -0400

Hello Nathan,

Nathan Dehnel <[email-masked]> writes:

> You should also setuid mount.nfs4 because the mount command calls that if
> you are using NFSv4.

[...]

I don't think that's necessary, if your program simply calls to the
'mount' command:

sudo strace -f -s200 mount localhost:/pub /tmp/pub

--8<---------------cut here---------------start------------->8---
[...]
[pid 19019] execve("/run/current-system/profile/sbin/mount.nfs", ["/run/current-system/profile/sbin/mount.nfs", "localhost:/pub", "/tmp/pub", "-o", "rw"], 0x7fff431b5038 /* 21 vars */) = 0
[...]
--8<---------------cut here---------------end--------------->8---

You see that mount ends up calling the mount.nfs binary, not mount.nfs4
(even though 'mount' reports this is using NFS v4.2).

If you have some software using mount.nfs4, that could be patched to
mount.nfs, as mount.nfs4 is just a symlink to mount.nfs.

Thanks,

Maxim