Thursday, October 5, 2017

Network File System (NFS)

This post is about how to setup NFS share, and how to access the NFS from another machine.

Both server and client must have nfs-utils installed.

yum install -y nfs-utils

Enable and start nfs-server on server machine.

systemctl enable nfs-server
systemctl start nfs-server

Say /data is to be shared as NFS.

The sharing information needs to be updated in /etc/exports, then reload the configuration. The syntax of /etc/exports is

<path to share> <allowed network>(<options>)

This means, any machine from this network can access to it.

You must enable this service in firewall as well.

firewall-cmd --permanent --add-service=nfs
firewall-cmd --reload

Let me create a file in the directory.

At client machine, you can set a permanent mount by specifying it in /etc/fstab.

If you create a file from this client machine, you'll get something like this.

There are a few options can be used to control the access level in /etc/exports.

rw : read write access.
ro : read only access.
root_squash : map client root to anonymous user, which you can see in the above testing (nfsnobody). This is turn on by default.
no_root_squash : turn off the root squashing.
all_squash : all client user will be mapped to anonymous user.

You can also set for secured access... but I am not familiar with it... yet. :P

No comments:

Post a Comment