0

Am trying to mount a NFS device in my linux machine.

My /etc/fstab is like this, 192.168.0.5:/volume2/Asterisk_Recordings /var/spool/newnfs nfs rsize=32768,wsize=32768,intr,noatime 1 0

My /etc/mtab is like this, 192.168.0.5:/volume2/Asterisk_Recordings /var/spool/newnfs nfs rw,addr=192.168.0.5 0 0

I have enabled NFS in my NAS device.

When i type mount " mount -t nfs -v 192.168.0.5:/volume2/Asterisk_Recordings /var/spool/newnfs/" I get like this, mount.nfs: timeout set for Thu Aug 1 07:01:04 2013 mount.nfs: trying text-based options 'vers=4,addr=192.168.0.5,clientaddr=192.168.1.1' mount.nfs: mount(2): Permission denied mount.nfs: access denied by server while mounting 192.168.0.5:/volume2/Asterisk_Recordings

Any possible reasons?

Thanks in advance.

Gopala Krishnan
  • 167
  • 3
  • 3
  • 10

5 Answers5

1

This error can also occur if the /etc/hosts file on the nfs server maps the hostname of the client to an incorrect IP address, or the IP address of the client to an incorrect hostname. It is quick and easy to check, so worth doing before looking for other problems. Note that, if you do have to change any entries then the nfs-server has to be stopped and re-started, as it reads the hosts file only when it is started.

user4792
  • 111
  • 1
0

Is there a config file on the NAS where to put allowances for clients? E.g. in debian based OS the config file is "/etc/exports" and you would put there "/volume2/Asterisk_Recordings 192.168.1.1(rw,sync)" and activate this with "exportfs -a" (your NAS may do this automatically if you update the config via a web interface, I guess.) Check also https://stackoverflow.com/questions/22246477/mounting-nfs-results-in-access-denied-by-server.

Community
  • 1
  • 1
dr0i
  • 2,380
  • 2
  • 19
  • 36
0

Remember to add IP addresses/hostnames of your NFS' clients to /etc/hosts.allow of NFS' server

nfs: clienthost2, clienthost2, clienthost3

You might restart nfs config and nfs service on the NFS server as well as run export again.

systemctl restart nfs-config.service
systemctl status nfs.service
exportfs -arv
Lukasz Dynowski
  • 11,169
  • 9
  • 81
  • 124
0

I have a Debian 10 system with a Debian 10 VM running inside it. I wanted to access a physical partition from the hard drive on the VM. I mounted the physical drive on the host and exported it. I was not able to mount it on the guest continually getting a access denied error

The solution after many hours was to add the no_all_squash option in the exports file. This is supposed to be the default but I needed to add it explicitly. As soon as I did that the problem went away and I could mount the file system. Unfortunately I could not see the files on the fs.

/media/dev 192.168.100.0/24(rw,sync,no_subtree_check,no_root_squash,no_all_squash)

On the server I could see the files and on the host I could not.

I had to change the line to

/media/dev 192.168.100.0/255.255.255.0(rw,sync,no_subtree_check,no_root_squash,no_all_squash)

to see the actual files that were on the file sets

BrownPony
  • 575
  • 4
  • 12
0

I saw this error presumably due to an older NFS client and adding -o nfsvers=3 fixed the issue for me e.g. mount -t nfs -o nfsvers=3 x.x.x.x:/nfs_mount /mnt/nfs_mount

Or in /etc/fstab

x.x.x.x://nfs_mount    /mnt/nfs_mount    nfs    proto=tcp,port=2049,nfsvers=3    0  0

Ref: https://www.thegeekdiary.com/mount-nfs-access-denied-by-server-while-mounting-how-to-resolve/

Jake Anderson
  • 221
  • 1
  • 2
  • 7