[PATCH nfs-utils] Give useful error if mount.nfs not installed setuid.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If mount.nfs is not installed setuid, an attempt to perform a "user"
or "users" mount will fail with a fairly obscure error message,
typically about getting "permission denied" from the server.

This patch gives a more helpful message in that case.

Signed-off-by: NeilBrown <neilb@xxxxxxx>

diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index 5076468..57360fb 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -539,6 +539,12 @@ int main(int argc, char *argv[])
 			mnt_err = EX_USAGE;
 			goto out;
 		}
+
+		if (geteuid() != 0) {
+			nfs_error(_("%s: not installed setuid - "
+				    "\"user\" NFS mounts not supported."));
+			exit(EX_FAIL);
+		}
 	}
 
 	if (chk_mountpoint(mount_point)) {
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux