Alwanza Home Extraordin-Air Team Final Project Linux Course Home
task 30.
Export a directory on your server via NFS.  Limit the exposure so that only your machine can mount it.

Steps:

added the following line to /etc/exports:

/var/www/cgi-bin 192.104.59.48/255.255.255.0(rw,nohide)

This translates to allow the /var/www/cgi-bin directory on this machine (air) to be exported to IP address 192.104.59.48 (air) using options of read-write and no hide (nohide permits the exported directory to be seen from its mount as if it were a regular directory there).

Added the following lines to /etc/hosts.deny

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

These lines were added for security purposes.  The /etc/hosts.allow file will get read first and only the services that are not allowed will be denied.  So what this will do (after the allow file allows local access to NFS) is deny NFS to any host NOT specified in the /etc/hosts.allow file.

added the following lines to /etc/hosts.allow

portmap: LOCAL
lockd: LOCAL
mountd: LOCAL
rquotad: LOCAL
statd: LOCAL

These lines are all proscribed by NFS.  All these demons are necessary for the NFS daemon to work.  By restricting them to "LOCAL" I am preventing NFS from exporting our files to other machines.

Errors to Avoid

While making changes to /etc/hosts.deny and /etc/hosts.allow, I managed to disable ssh!  I discovered this when I attempted to ssh in to air from a second terminal window (lucky me, I had not exited the other terminal yet).  I therefore added one more line to the /etc/hosts.allow file and tested to ensure that I could ssh in.

sshd: ALL

After making changes to the files, there were daemons to restart:

exportfs
exportfs -ra

root[/etc]# service nfs start

Starting NFS services:  [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
root[/etc]# service nfslock start
Starting NFS statd: [ OK ]
root[/etc]#rpcinfo -p
programversprotoport
1000002tcp111portmapper
1000002udp111portmapper
1000013udp977rstatd
1000012udp977rstatd
1000011udp977rstatd
3910022tcp1587sgi_fam
1000042udp1001ypserv
1000041udp1001ypserv
1000042tcp1004ypserv
1000041tcp1004ypserv
1000072udp608ypbind
1000071udp608ypbind
1000072tcp611ypbind
1000071tcp611ypbind
1000032udp2049nfs
1000033udp2049nfs
1000211udp1703nlockmgr
1000213udp1703nlockmgr
1000214udp1703nlockmgr
1000111udp1004rquotad
1000112udp1004rquotad
1000111tcp1007rquotad
1000112tcp1007rquotad
1000051udp1708mountd
1000051tcp2003mountd
1000052udp1708mountd
1000052tcp2003mountd
1000053udp1708mountd
1000053tcp2003mountd
1000241udp1709status
1000241tcp2004status