Thursday, 31 May 2007

NFS quick guide

NFS - Network File System

Get NFS installed via Synaptic Package Manager on 2 PCs, sourcePC and destPC.

/nfsdir is created on both PCs and /nfsdir contains files on sourcePC which need to be shared.

Edit /etc/exports file on sourcePC:

# two machines which share files under /nfsdir

/nfsdir sourcePC(rw) destPC(rw)

sourcePC is the PC which runs NFS server and shared files are stored under /nfsdir.

For security, add two files under /etc, hosts.deny and hosts.allow:

#hosts.deny

portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL

#hosts.allow

service: sourcePC , destPC

#sourcePC 192.168.10.2; destPC 192.168.10.3
portmap: 192.168.10.2 , 192.168.10.3
lockd: 192.168.10.2 , 192.168.10.3
rquotad: 192.168.10.2 , 192.168.10.3
mountd: 192.168.10.2 , 192.168.10.3
statd: 192.168.10.2 , 192.168.10.3

Start NFS server by /etc/init.d/nfs-kernel-server start

Check the status of NFS, rpcinfo -p.

Go to destPC. To view the contents of /nfsdir on sourcePC, mount remote directory first.

sudo mount sourcePC:/nfsdir /nfsdir

Now the contents of /nfsdir on sourcePC could be available on destPC.

Here is a link about NFS.

No comments: