28-mar-2016: Welcome to our new server! Faster and less prone to crashing.

Welcome to the Slackware Documentation Project

NFS - Quick and Dirty Setup

Known to work on Slackware 14 & 14.1


1) This HOWTO assumes that you are using a vanilla install of Slackware and have not changed the default HOSTS_ALLOW, HOSTS_DENY, or firewall rules.
2) For this example, the shared directory on the server will be /nfs_share
3) For this example, the mount point of the NFS share will be /mnt/nfs_share
4) We want anyone on our subnet (192.168.1.x) to have RW access the share


1) Setup the server
2) Setup the client
3) Mount the NFS directories on the client

Server Setup

Add the NFS shares to the /etc/exports file

vi /etc/exports



Start the NFS and RPC daemons

chmod 755 /etc/rc.d/rc.nfsd
chmod 755 /etc/rc.d/rc.rpc
/etc/rc.d/rc.nfsd start
/etc/rc.d/rc.rpc start

Export the shares

exportfs -a

Check to see if the shares are being shared


Client Setup

Create the mount point

mkdir /mnt/nfs_share

Start the RPC daemon

chmod 755 /etc/rc.d/rc.rpc
/etc/rc.d/rc.rpc start


On the CLIENT machine, you have 3 options here: manually mounting, auto-mount at boot, or semi-auto mount


mount my.nfs.server:/nfs_share /mnt/nfs_share

Add the mount command to /etc/fstab

 vi /etc/fstab


my.nfs.server:/nfs_share /mnt/nfs_share nfs rw,defaults 0 0

Add the mount command to /etc/fstab

 vi /etc/fstab


my.nfs.server:/nfs_share /mnt/nfs_share nfs rw,noauto 0 0

then when you want to mount, just run:

mount /mnt/nfs_share

If you mount at boot and the server machine is unavailable, it will cause your client machine to take a long time to boot as the NFS client will make multiple attempts to connect and you will have to wait for it to time-out for each attampt.

For The Impatient

All the steps with no explanation:

echo "/SHARED_DIR YOUR_SUBNET/24(rw,sync,no_subtree_check)" >> /etc/exports
chmod 755 /etc/rc.d/rc.nfsd
chmod 755 /etc/rc.d/rc.rpc
/etc/rc.d/rc.nfsd start
/etc/rc.d/rpc start
exportfs -a


mkdir /mnt/nfs_share
chmod 755 /etc/rc.d/rc.rpc
/etc/rc.d/rc.rpc start
echo "YOUR_NFS_SERVER:/SHARED_DIR /CLIENT_MOUNT_POINT nfs rw,defaults 0 0" >> /etc/fstab


PROBLEM: NFS shares won't mount on client box with a “Stale NFS file handle” error.
1) Forcibly unmount the directory on the CLIENT machine (if mounted):

umount -f /mnt/nfs_share

2) Flush the NFS registry on the SERVER machine:

exportfs -f

3) Remount the NFS share

4) No Root Squash: There are many options for NFS and I want to keep this article short but effective so I am leaving out many of the various configuration items that you could do. However there is one option that is worth mentioning, no_root_squash. By default NFS will downgrade any files created with the root permissions to the nobody user. This is a security feature that prevents privileges from being shared unless specifically requested. If I create a file as the root user on the client on the NFS share, by default that file is owned by the nobody user.

 root@client:~# touch /shared/nfs1/file2 
 root@server:/nfs# ls -la file2
 -rw-r--r-- 1 nobody nogroup 0 Nov 18 18:06 file2

Sometimes it is important to share files that are owned as root with the proper permissions, in these cases this can be done by simply adding the no_root_squash attribute to the /etc/exports configuration.

Edit the /etc/exports file:



In Other Languages
Translations of this page?:
QR Code
QR Code howtos:network_services:nfs-quick_and_dirty_setup (generated for current page)