Problems mouninting an NFS share on CentOS 7: mount.nfs: access denied by server while mounting

I have Ubuntu 16.04 host with an IP address of 192.168.1.35, and two VM clients: Ddebian 8 Jessie and CentOS 7. I run nfs server on my host and nfs client on both on my guests. As of Debian guest it mounts nfs-share from host without any problem. The problem is in my CentOS guest

When I try to mount the nfs-share from within the guest it issues the following error:

[hedin@localhost ~]$ sudo mount -a
mount.nfs: access denied by server while mounting 192.168.1.35:/home/hedin/export/eudyptula

This is my guest's /etc/fstab:

#
# /etc/fstab
# Created by anaconda on Mon Apr 10 16:16:12 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/cl-root / xfs defaults 0 0
UUID=46ddae58-4556-492c-8e23-8c56a4e067d9 /boot xfs defaults 0 0
/dev/mapper/cl-swap swap swap defaults 0 0
192.168.1.35:/home/hedin/export/eudyptula /home/hedin/mnt/host nfs rw,hard,intr,bg 0 0

Firewall is disabled:

[hedin@localhost ~]$ systemctl is-enabled firewalld
disabled

SELinux is disabled:

[hedin@localhost ~]$ cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
SELINUX=disabled
SELINUXTYPE=targeted

All hosts are allowed:

[hedin@localhost ~]$ cat /etc/hosts.allow
#
# hosts.allow This file contains access rules which are used to
ALL: ALL: ALLOW

We could see host nfs-share from within the guest:

[hedin@localhost ~]$ sudo showmount -e 192.168.1.35
Export list for 192.168.1.35:
/home/hedin/export/eudyptula 192.168.1.0/24
/home/hedin/export 192.168.1.0/24

And this is my hosts's /etc/export configuration:

hedin@home:~/projects/open-source/linux$ cat /etc/exports
/home/hedin/export 192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,async)
/home/hedin/export/eudyptula 192.168.1.0/24(rw,nohide,insecure,no_subtree_check,async)

So, I don't know what I have missed in my configuration. Any ideas?

2 Answers

The problem was in /etc/exports file on the server. Client's VM IP didn't match the server IP mask. I have allowed an access to any IP, and now I am able to mount the shares on the guest. This is the new config:

/home/hedin/export *(rw,fsid=0,insecure,no_subtree_check,async)
/home/hedin/export/eudyptula *(rw,nohide,insecure,no_subtree_check,async)

Kindly remove the following line in the file /etc/sysconfig/selinux and reboot the centos 7 machine.

SELINUXTYPE=targeted

Kindly update the following line in the file /etc/fstab and again mount the shared folder in centos 7 machine.

192.168.1.35:/home/hedin/export/eudyptula /home/hedin/mnt/host nfs defaults 0 0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like