Nfs

From Andreida

Server

install the server (which gets the dependencies nfs-common and portmap:

apt-get install nfs-kernel-server

Export the directory you want to share in /etc/exports:

/home        192.168.0.1(rw) 192.168.0.2(ro)

Disallow all machines to use the services around nfs via /etc/hosts.deny

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

Allow your clients to use the services arround nfs via /etc/hosts/allow

portmap: 192.168.0.1 , 192.168.0.2
lockd: 192.168.0.1 , 192.168.0.2
rquotad: 192.168.0.1 , 192.168.0.2
mountd: 192.168.0.1 , 192.168.0.2
statd: 192.168.0.1 , 192.168.0.2

Restart the services

/etc/init.d/portmap restart
/etc/init.d/nfs-kernel-server restart

If you change your /etc/exports file while your nfs is running, use this command to force an update:

exportfs -rav


Client

Install the client: (portmap is a dependency)

apt-get install nfs-common

Test the nfs:

mount server:/home /mnt/test
ls /mnt/test

Get the correct entry:

cat /etc/mtab
umount /mnt/test

Set it, so this is done for every boot:

vi /etc/fstab
mount /mnt/home

Example for the /etc/fstab:

my-private-server:/mnt/home /mnt/home nfs rw,addr=192.168.0.100 0 0

Check the owner of the mounted data with

ls -l /mnt/home

If the owner is something like 300, consider adding a group

addgroup --gid 300 sambagroupOrSo

and adding the user to the group

adduser <user> <group>

You can find out the gid and name of the files in the /etc/group file of the server.