Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Mount NFS shares as different users

Delmir

Newbie
Joined
Jun 10, 2020
Messages
2
Hi,

I'm unable to mount NFS shares on a FreeNAS/11.3 from Linux/Debian/10 as regular users. It works fine as "root"!

Would anyone please advise what would be the proper way to set 3 different NFS shares on FreeNAS so each Linux user can access it's "own" share (one directory for each user)?

I've set (or tried to set) the user's UID and GID the same on both client and server (no Directory Services anywhere). My main hunch is related to the way Linux mounts (or fails) the shared NFS points since it shows "nobody 4294967294" for user and group.

>pwd
/mnt
>ls -l
total 20
drwxr-xr-x 2 someu someu 4096 Jun 21 23:23 NFS-someu

>sudo mount -t nfs4 -o v4,rw,noexec,users,nfsvers=4,proto=tcp,uid=1000,gid=1000 freenas.lan:/mnt/Pool-5x1TB/someu /mnt/NFS-someu
mount.nfs4: an incorrect mount option was specified
>sudo mount -t nfs4 -o v4,rw,noexec,users,nfsvers=4,proto=tcp freenas.lan:/mnt/Pool-5x1TB/someu /mnt/NFS-someu
>ls -l
total 17
drwxr-xr-x 2 nobody 4294967294 2 Jun 21 17:12 NFS-someu



>sudo mount -t nfs -o v3,rw,noexec,users,nfsvers=3,proto=tcp,uid=1000,gid=1000 freenas.lan:/mnt/Pool-5x1TB/someu /mnt/NFS-someu
mount.nfs: an incorrect mount option was specified
>sudo mount -t nfs -o rw,noexec,users,nfsvers=3,proto=tcp,uid=1000,gid=1000 freenas.lan:/mnt/Pool-5x1TB/someu /mnt/NFS-someu
mount.nfs: an incorrect mount option was specified
>sudo mount -t nfs -o rw,noexec,users,nfsvers=3,uid=1000,gid=1000 freenas.lan:/mnt/Pool-5x1TB/someu /mnt/NFS-someu
mount.nfs: an incorrect mount option was specified
>sudo mount -t nfs -o rw,noexec,users,nfsvers=3 freenas.lan:/mnt/Pool-5x1TB/someu /mnt/NFS-someu
>ll
total 17
drwxr-xr-x 2 root root 2 Jun 21 17:12 NFS-someu
cd NFS-someu/
>ll
total 0
>touch tt
touch: cannot touch 'tt': Permission denied
>


>umount /mnt/NFS-Someu
>cat /etc/fstab
...
freenas.lan:/mnt/Pool-5x1TB/Someu /mnt/NFS-Someu nfs rw,async,hard,intr,noexec,noauto,users,nfsvers=4,proto=tcp,uid=1000,gid=1000 0 0
...
>mount /mnt/NFS-Someu/
mount.nfs: an incorrect mount option was specified



>umount /mnt/NFS-Someu
>cat /etc/fstab
...
freenas.lan:/mnt/Pool-5x1TB/Someu /mnt/NFS-Someu nfs rw,async,hard,intr,noexec,noauto,users,nfsvers=4,proto=tcp 0 0
...
>who
Someu tty7 2020-06-29 16:10 (:0)
>mount /mnt/NFS-Someu/
>ls -l
total 17
drwxr-xr-x 2 nobody 4294967294 2 Jun 21 17:12 NFS-Someu
>cd NFS-Someu/
>touch tt
touch: cannot touch 'tt': Permission denied




cat /etc/modprobe.d/nfs.conf
options nfs nfs4_disable_idmapping=N


uname -a
Linux ds18 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 GNU/Linux
 

Fredda

Senior Member
Joined
Jul 9, 2019
Messages
485
I'm unable to mount NFS shares on a FreeNAS/11.3 from Linux/Debian/10 as regular users. It works fine as "root"!
That is exactly the way it should be. Only root can mount via nfs.

The correct way to so would be:

mount -t nfs FreeNAS.lan:/mnt/pool/usersvol /mnt/uservol/

Replace usersvol with the name you are using. Then below this should be subdirectories with usera, userb ...
The directories should of course have the proper permissions and UID/GID matching the ones on your linux box.

Try to use NFS first and not NFSv4, the latter adds a small amount of additional complexity, I wrote a little bit about the difference here:


Your nobody 4294967294 ownerships are an indication of an incorrect idmap setup needed for NFSv4.

Please use [code][/code] tags in your future posts. This makes it much easier to read.
 

KrisBee

Neophyte Sage
Joined
Mar 20, 2017
Messages
1,083
Run the FreeNAS NFS service with both "NFSv4" and "NFSv3 ownership model for NFSv4 " selected, then you don't have to worry about setting up id mapping on the linux side.

Does @Delmir have multiple users on one liunx box, or a single user per linux box that requires access to a NFS share?
 
Last edited:
Top