1

On Ubuntu 20.04.6 LTS I want to share a USB drive connected to a DD-WRT router using NFS, but I cannot have writing permission for a regular user. The NFS share is indeed setup read/write in the router.

dd-wrt screenshot

I included the following line in /etc/fstab .

192.168.3.1:/mnt/sda4 /home/john/smbnas nfs rw,user,noauto 0 0

...which allows all users to mount the share. Unfortunately I get the following output from ls -l when I mount the folder:

drwxr-xr-x 19 root  root 

....so the folder belongs to root and is not writable by others. I tried the following change in /etc/fstab .

192.168.3.1:/mnt/sda4 /home/john/smbnas nfs rw,user,noauto,uid=1000,gid=1000 0 0

but I get this error:

mount.nfs: an incorrect mount option was specified

I am running Ubuntu 20.04. Changing the mount point to /mnt or /media has no effect. I get the same permissions as before.

What am I doing wrong here? What should I do to get mount and write access for regular users?

karel
  • 122,292
  • 133
  • 301
  • 332

1 Answers1

0

NFS maps UID/GID's directly, so the local user UID must match the permissions on the remote side.

First, figure out what your users UID is by running id -u; id -g on your machine. This will give you two numbers - UID and GID

Second, connect to the DD-WRT system via e.g. SSH, and log in as root. Run chown UID:GID /mnt/sda4/ to change owner of the shared directory to your user. UID:GID is the two numbers you got when running id.

vidarlo
  • 23,497