Linux 101 : A short introduction to NFS - exportfs, mount, ... -

Configuring an nfs share on the server and the client: 

We start by creating the directory to be shared "shared_dir" using the below command:

We create an entry for that shared folder in the "/etc/exports" file as we can see below:

The access rights are - readwrite -. If we leave the access rights blank, the shared directory will be mounted as read-only.

The root_squash option indicates that nfs user will have the same UID on the nfs client and the nfs server.

We use it to prevent the root user from inadvertently connecting to the share, creating security issues.
When we use the root_squash parameter, it converts the root UID to an "unprivileged" user with limited access rights.


no_root_squash - is the default configuration.

We run the "exportfs" command to make these shared resources available to the nfs clients"

On the nfs client, we use the below command to mount the nfs directory to be able to use :

nfs_server could be the IP address of the nfs server or its name.

To avoid typing the above command after each reboot, we can configure the nfs client to mount the shares automatically by adding the below in the "/etc/fstab" file:

- The dump and pass parameter are both set to "0".
nfs3 : refers to used version of the nfs software.


Leave as a comment: