NFS mount fails with “access denied by server”

Symptom

When mounting a valid share, NFS denies access:

$ mount /mnt/backup
mount.nfs: access denied by server while mounting server:/share/USBDisk1

Solution

The mount point is not exported.
Find out where the mount point points to on the client side (although, that info was already in the error message):

$ cat /etc/fstab
# /etc/fstab: static file system information.
...
# Backup disk on 1TB external USB drive - no auto mount
server:/share/USBDisk1 /mnt/backup nfs defaults,users,noexec,noauto

On the server side:

$ ssh admin@server
# ll /share/USBDisk1
lrwxrwxrwx    1 admin    administ        20 Feb 21 00:03 /share/USBDisk1 -> /share/external/sdt1/

# cat /etc/exports
"/share/MD0_DATA/Download" *(rw,async,no_root_squash,insecure)
"/share/MD0_DATA/Multimedia" *(rw,async,no_root_squash,insecure)
"/share/MD0_DATA/Public" *(rw,async,no_root_squash,insecure)
"/share/MD0_DATA/Web" *(rw,async,no_root_squash,insecure)

As you can see, /share/external/sdt1/ is not there, edit the file and add the line:

"/share/external/sdt1" *(rw,async,no_root_squash,insecure)

For added security, you may want to replace “*“ with something like

192.168.1.0/24

Then use (this is the critical part):

[~] # exportfs -a

You’ll get a bunch of error messages:

exportfs: /etc/exports [5]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/share/external/sdt1".
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x

but that’s fine, they can be ignored.

Finally:

$ mount /mnt/backup

will work as expected.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: