Saturday, 23 April 2011

Configuring NFS


File sharing between to linux boxes with NFS

start nfs service on the server machine and client machine
Server : 192.168.1.2
Client:    192.168.1.1

service nfs start

edit /etc/exports file and add the location you want to share

this is the entry to be added to exports file to share a folder called test in home directory. (rw) will allow both read and write

folder_name_with_path host_name(options)
host_name is the name of the host(client IP or client hostname) from where you are going to mount this share

ex: if you want to share a folder called test in home folder to a client with ip address 192.168.1.1 do as below..

edit export file to add this entry (this is entered host server whose folder is actually shared)

on Server(192.168.1.2)

/home/test 192.168.1.1(rw)


go to cleint machine and start nfs service


then mount the nfs sharing

mount -t nfs -o rw nfs_server_name://folder_name_with_path mount_point

on Client(192.168.1.1)
mount -t nfs -o rw 192.168.1.2://home/test /testnfs

see man page of mount to see all the mount options.

now you can see the sharing as a folder in your own filesystem with read write permission