Solved How to mount NFS file systems as non-root user?

Hello, I'm new to FreeBSD. I'm trying allow non-root users to be able to freely mount NFS filesystems, but I'm not sure what I'm missing? Mounting physical media is working well, but the moment I try to mount an NFS disk it throws an error.

I'm both new to FreeBSD and NFS filesystems, so I'm sure there something obvious that I'm missing, any help would be greatly appreciated, thank you!

I was following the following threads/docs:

Code:
$ sysctl vfs.usermount
vfs.usermount: 1

$ cat /etc/groups | grep 'operator'
operator:*:5:root,user

$ ls -l /mnt/user/
drwxr-xr-x  2 user user  usb1
drwxr-xr-x  2 user user  network_share

$ ls -l /var/da0s1
crw-rw----  1 root operator  /dev/da0s1a

$ mount /dev/da0s1 /mnt/user/usb1

$ mount -t nfs XXX.XXX.XXX.XXX:/share/path /mnt/user/network_share
mount_nfs: can't update /var/db/mounttab for XXX.XXX.XXX.XXX:/share/path

$ ls -la /var/db/mounttab
ls: /var/db/mounttab: No such file or directory

Initially, I assumed that it was giving such error due to a permission error with the virtual node associated with XXX.XXX.XXX.XXX:/share/path, but I couldn't seem to find any node. So instead I set the physical diskk, /dev/da0s1a, to be read-only and try to mount it, to see if I could reproduce the error with other devices, but it instead threw a different permission error:

Code:
# chmod g-w /var/da0s1

$ ls -l /var/da0s1
crw-r-----  1 root operator  /dev/da0s1a

$ mount /dev/da0s1 /mnt/user/usb1
mount: /dev/da0s1a: Operation not permitted

Also to note, running the same NFS mount command as root user, seems to work as expected.

Code:
# mount -t nfs XXX.XXX.XXX.XXX:/share/path /mnt/root/network_share
 
Okay I feel a bit dense, I played around with it a bit more, created the /var/db/mounttab file, set file ownership to root:operator, and file privledges to g+rw, now it seems to work fine!

Code:
# touch /var/db/mounttab
# chown root:operator /var/db/mounttab
# chmod g+rw /var/db/mounttab

I am going to mark this as completed.
 
Back
Top