Tuesday, August 18, 2009

Short Notes on NFS

Network Files System NFS uses rpc portmap. It allocates random UDP port number to NFS server for I/O operation. Dont worry to set portmapper. It will work by default. In case you want to see if its working use command

ps -aux | grep portmap

To see port number assigned to various services by portmapper use command

rpcinfo -p

Various services need to be setup for NFS are NFS, netfs, amd and autofs. To check if NFS is installed use command

rpm -qa | grep nfs

To secure the NFS you would normally disable all unnecessary services in hosts.allow. A typical hosts.allow would look like below.

/etc/hosts.allow
portmap:192.168.0.
rpc.mountd:192.168.0 .
rpc.nfsd:192.168.0.
nasd:192.168.0.

Now to export a particular directory open /etc/export file and write the following line

/home/ullas 192.168.0.1(rw)

To export directory issue command

exportfs -a

It will update /var/lib/nfs/xtab. If you change /etc/exports and want immediate effect use

exportfs -r

Then no reboot is necessary.

On the client side use command

showmount --exports servername

amd and autofs are two automatic mounting systems. Use anyone if necessary.

UID and GID should be same across all client and servers. If /etc/export is changed issue command

exportfs -a
or
exportfs -r on client

To mount it in on client use command

mount servername:/home/use rname1 /home/username2

This mounts home directory of two users.

No comments: