Nfs Mount Based on User

Nfs Mount Based on User

I have a linux station (ubuntu 20.04) and I have a mountpoint /share (that is currently mounted as CIFS but I could also use NFS if needed).

I’d like that two different users with local accounts, logged at the same time, to be able to access the mount /share with their own credentials. How can I do that?

1 Answer

That's already how NFS works. It's how NFS has worked since day one.

By default, NFS simply reports the current UID to the server (-o sec=sys), and the server just blindly trusts the client to not lie. If you want more security than that, you will need to set up Kerberos with sec=krb5i.

A similar multi-user mode is available for SMB (cifs) as well – you can enable it by mounting the share with the -o multiuser mount option.

Because SMB authentication isn't UID-based, each user will need to load their own credentials using cifscreds add before they're allowed to access the mount. You can set up pam_cifscreds to make this more automatic (storing the users' login passwords) or, again, run Kerberos.

(Nearly the same Kerberos setup can be used for both NFS and SMB.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.