Setting up an NFS 4 Server with Clients

There are many good HOWTOs out there how to setting up NFS-Servers. I will try to seize together how to set up those with Clients, also Windows-Clients and Firewall-Rules. My testing environment is: As Server, Fedora 18 (without SELinux). Clients are Fedora 19 and Windows 7.


Server side


Install the NFS packages by typing:

# yum install nfs-utils


Configuring NFS / Creating Shares

To create the first share:

# vi /etc/exports

Your share should look like this:

/mnt/nfs  192.168.1.*(rw,all_squash)

I use here rw (read/write) and all_squash (direct all users to nfsnobody) because I want that all users (in this net) can write, read and delete files in that directory.

Or this:

/mnt/nfs 192.168.1.*(ro)

Here I use rw (read/write) for one specified user an ro (read only) for all other users on this network.

Note: If you make changes in /etc/exports, you have to re-export them. With this command you don’t have to restart the nfs-server.service.

# exportfs -ra


Starting the Server

Start the and enable the Server:

# systemctl start nfs
# systemctl enable nfs-server.service

Note: You don’t have to enable the Server just for testing, but it will not be started after a reboot.



Basically, without nfs-over-udp and without backward compatibility, you only need to add this two rules in your /etc/sysconfic/iptables (for RPC 4 portmapper and NFSD (nfs server)):

-A INPUT -m conntrack --ctstate NEW -p tcp --dport 111 -j ACCEPT
-A INPUT -m conntrack --ctstate NEW -p tcp --dport 2049 -j ACCEPT


Bind a Client-User to a Server-User

For that you must have the same UID and/or GID.


Client side


Install the NFS packages by typing:

# yum install nfs-utils



Make a directory for mounting to:

# mkdir /mnt/nfs

Finally mount the nfs-share:

# mount -t nfs SERVER:/mnt/nfs /mnt/nfs


Mounting with fstab

Simple as that:

SERVER:/mnt/nfs    /mnt/nfs        nfs     defaults        0 0


Windows Installation

Go to Control Panel > Programs and choose Turn Windows features on or off. Check Services for NFS and both, Administrative Tools and Client for NFS, and install it. Reboot.



Open a cmd and mount the nfs-share with:

C: mount SERVER:/mnt/nfs *

Hint: Make a cmd-file (e.g: nfs.cmd) with something like “mount SERVER:/mnt/nfs *” inside and place it on your desktop.



Go here:


kernel: nfs: server not responding, still trying

If you transfer large files, this can be a problem of a 3ware Controller because of too much IO-Operations on the drive (or raid) and StoreSave is set to Protection. Setting this to Performance solves the problem. Although this is not a good choice because of data loss in the event of power failure.


It is possible to force user permissions like samba (create mask/force directory mode) ?

Nope. Even with Access Control Lists it is not possible. Maybe you want to do a cronjob which runs periodically like (crontab -e):

0 0 * * 0 find /mnt/nfs/ -type f -exec chmod -v 644 {} \; && find /mnt/nfs/ -type d -exec 
chmod -v 755 {} \; && echo '...done!' | mail -s 'CHMOD cronjob' 2>&1

This will change the permission once per week (Sunday 00:00) and finally send you an E-Mail.


I see files in my Trash who aren’t from me

This is because You have the same UID and/or GID as the User who own the NFS-Share. Chance it.

This entry was posted in Fedora, Linux, Mac OS X, NFS, Windows and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.