NFS (Network File System) for Beginners

NFS (Network File System) for Beginners: In this post I am trying to build a base for the beginners. This post will help to proceed further with NFS complex tasks.

What is NFS?

NFS —> Network File System —> The Network File System (NFS) is a client-server service that enables users to view, store, and update files on a remote server as though they were on the their own local server. In Simple layman language NFS provides a “Centralized File Access”.

Example: Suppose you have a 100 users in a company. Out of which 50 require complete access to 10 files/softwares etc. for there daily day to day work and other 50 require access to other commonly used 15 files/softwares etc. for there work. Now instead of placing individual files/softwares on each users server (computer) you should keep the files/softwares in a common shared place which users would have access to. Now each user can access (read/write/modify –> depending upon access provided) those commonly used files/softwares remotely without having them on his/her local server/computer. This will help to save the diskspace as well on all users server.

NFS Model:


Server client mode —> NFS is based on Server-C;ient Model. The server where the files are physically stored is called “Master server” and the server which is using thoses files remotely are called “Client server”.

Note: The Solaris 10 OS supports versions 2, 3, and 4 NFS simultaneously. The default is to use NFSv4.

NFS Server Files:


/etc/dfs/dfstab —> defines the files/directory to be shared (command used is share), also run shareall command after editing this file. Lists the local resources to share at boot time.

/etc/dfs/sharetab —> shows the result of share command. All share file/dir. will be shown here. Lists the local resources currently being shared by the NFS server. Do not edit this file.

/etc/dfs/fstypes —> Lists the default file system types for remote file systems.

/etc/rmtab —> Contains the table of filesystems remotely mounted by the client. (mountd daemon).

/etc/default/nfs —> parameters for NFS daemons and protocols.

/etc/default/nfslogd —> Lists configuration information describing the behavior of the nfslogd daemon for NFSv2/3.

NFS Server Service:


NFS Server Service: We have to Enable the NFS server service, svc:/network/nfs/server.

# svcs -a | grep -i /network/nfs/server

# svcadm enable /network/nfs/server

# svcs -a | grep -i /network/nfs/server



mountd —> handles clients filesystem mount requests.

nfsd —> client FS request.

statd —> work with lockd for recovery function.

lockd —> recored locking operation.

nfslogd —> Provides operational logging for NFSv2 and 3.

nfsmapid —> NFS users & grps mapping.



share —> shows the shared files (i.e shows the contents of /etc/dfs/sharetab). Makes a local directory on an NFS server available for mounting. It also displays the contents of the /etc/dfs/sharetab file.

unshare —> unshare all. Makes a previously available directory unavailable for client side mount operations.

shareall —> (/etc/dfs/dfstab) —> shows all entries from this file and execute them.

unshareall —> unshare all. Makes previously shared resources unavailable.

dfshares —> show the shared resources.

dfmounts —> Show the currrently mounted FS.



/etc/vfstab —> Defines file systems to be mounted locally. eg: raheja:/usr/nfstest – /yogeshtest nfs – yes soft,bg

/etc/mnttab –> Lists currently mounted file systems, including automounted directories. The contents of this file are maintained by the kernel and cannot be edited.

/etc/dfs/fstypes —> Lists the default file system types for remote file systems.

/etc/default/nfs —> Contains parameters used by NFS protocols and daemons.



statd —> Works with the lockd daemon to provide crash recovery functions for the lock manager.

lockd —> Supports record-locking operations on NFS files.

nfs4cbd —> callback daemon for NFSv4.



dfshares —> lists shared resources.

mount —> mount the shared FS. eg: for sharing from single and multiple servers, mount raheja:/usr/nfstest /yogeshtest  and  mount -o ro raheja1,raheja2,raheja3:/multi_homed_data /remote_shared_data

umount —> Unmounts a currently mounted file resource.

mountall —> Mounts all file resources or a specific group of file resources listed in the /etc/vfstab file with a mount at boot value of yes.

umountall —> Unmounts all non-critical local and remote file resources.


A Simple example to share a file from NFS master server to Client server.

On NFS server:


1.) make one directory as /usr/nfstest.

# mkdir /usr/nfstest

2.) edit /etc/dfs/dfstab file with the shared dir/file info.

# share -F nfs -o ro -d “test NFS sharing” /usr/nfstest

3.) execute share -F nfs /usr/nfstest.

# share -F nfs /usr/nfstest

share [ -F nfs ] [ -o options ] [ -d description ] [ pathname ]


-F nfs Specifies the file system type. This option is not typically required, because NFS is the default remote file system type.

-o options Controls a client’s access to an NFS shared resource.

-d description Describes the shared file resource.

pathname Specifies the absolute path name of the resource for sharing.

4.) share command will show you the output now.

On NFS Client:


5.) On client edit /etc/vfstab

eg: raheja:/usr/nfstest – /yogeshtest nfs – yes soft,bg

6.) Make directory (/yogeshtest) and mount it.

# mount raheja:/usr/nfstest

7.) df -k will show you the shared dir/file now.

Note: 1.) This is the simplest representation of NFS. This will help you to build a base to perform complex NFS tasks. You will find many NFS related issues with their

resolution at our side as we have already posted many posts on NFS.

2.) You can check NFS services running on Server or Client via svcs -a | grep -i nfs.

3.) Kindly refer default files as stated in the post in the server itself for more clarity (eg: cat /etc/dfs/dfstab etc.)

4.) Also it would be more useful to go through the man pages of NFS commands.

Yogesh Raheja

Yogesh working as a Consultant in Unix Engineering by profession. And he has multiple years experience in Solaris, Linux , AIX and Veritas Administration. He has been certified for SCSA9, SCSA10, SCNA10, VXVM, VCS, ITILv3. He is very much passionate about sharing his knowledge with others. Specialties: Expertize in Unix/Solaris Server, Linux (RHEL), AIX, Veritas Volume Manager, ZFS, Liveupgrades, Storage Migrations, Cluster deployment (VCS and HACMP) and administration and upgrade on Banking, Telecom, IT Infrastructure, and Hosting Services.

12 Responses

  1. Ram says:

    Thanks Yogesh for the detail explanation of NFS.

  2. Michael Michael says:

    @ Yogesh nice explanation mate 

    Well here if you take up NFS by default who ever access the NFS share the nfs server sees the user as anonymous no matter even if he is superuser at nfs client it  assigns the UID of nobody and hence tho he is being a superuser he may not be able to write or read etc etc on the share .

    Its always better have a clear picture on the user accessiblity and give -o anon=0 while sharing using share -F nfs -o rw,-anon 0 -d “test NFS sharing” /usr/nfstest this says that whoever access the share the NFS would assign the anonymous id to be of “0” that is root 

  3. Yogesh Raheja says:

    @Michael, thanks for this nice info.

  4. Michael Michael says:

    @ Yogesh i do have a doubt here in NFS the authentication happens only based on the server so what would happen if someone who does su on the client and impersonates as root ..arent we compromising on security here ?but this is neverthless case for unix 

    • Ramdev Ramdev says:

      @Michael, I guess you have answered your self, partially, in your previous comment. I.e every user who ever access the nfs share will be treated as nobody user, even the root@client.

      If we want to assign a specific UID for all incoming users we can use anon parameter, but One important thing to keep in mind while using anon=0, by enabling this option on server configuration you will end up with saying that who ever have access to that mount point from the client they will be treated as root and can able to modify/delete root owned files in that mount point, so it is not really recommendable .

      There are ways to solve this issue in more controlled manner by configuring nfs to use nis and netgroup based user authentication.

  5. Santosh says:

    Hi Ramdev,
    if we want to share the files to few people then what is the command? i mean i don’t want to give the access to all the users in the network, i want to give permission to only a few people to access that NFS folder.
    then what are the steps for that?

  6. ramdev says:

    @santosh – it is possible to share the files to specific users, specific machines and group of users …. to implement the solution you should create a netgroup with the listed users and then  share the directory  with  “-o rw = netgroup-name” option.

  7. Santosh says:

    creating a netgroup means creating that netgroup with listed users in NIS?
    if not in NIS can you let me know how to create Netgroup?
    and also what is the difference between group and Netgroup.

  8. ramdev says:

    @santosh – netgroups will work only when joined with nis/ nis+ / ldap… and please look page for more information. It is not exactly talkign about nfs permissions, but still it will give you an idea on how netgroups works.

  9. Vishal Mandle says:

    Yogesh, Good explaination.. can you please add up the difference between NFS Version 3 and version 4.

  1. September 15, 2015

    […] NFS (Network File System) for Beginners […]

  2. September 16, 2015

    […] Read – NFS Beginners Guide […]

What is in your mind, about this post ? Leave a Reply

  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us