Setting up NFS Share on Linux
2 minutes read •
On_Server
- Install required server components.
- Check if the service is alive.
- Create the export directory for the NFS share.
- Edit the /etc/exports file. A client can be identified either through a specific IP address, an entire subnet, or a domain name.
# Usage
) )
# Example
)
- Apply the configuration changes using the
exportfscommand.
- View all the active exports and verify the
/nfs/share/project1directory has export status.
)
- Restart the NFS utility using
systemctl.
On_Client
- Create the directory where you wanna mount the share.
- Mount the share.
# Usage
# Example
Persistent mount (Client)
The mount only persists until the system reboots. To automatically mount the directory when the system activates, add the mount point to the /etc/fstab file. The entry should consist of the export directory, the local mount point, a list of options, and two 0’s. To see all the available options for this file, run man nfs on the client.
Configuring the Firewall (Server)
Add a rule to allow port 2049 to accept traffic from the client’s IP address. Replace client_ip_addr with the address of the client.
Extras (Server)
- For security reasons, NFS translates any root credentials from a client to nobody:nogroup. This restricts the ability of remote root users to invoke root privileges on the server. To grant client root users access to the export directory, change the directory ownership to nobody:nogroup.