nfs
Overview: nfs is short for Network File System. It's used to share filesystems in the unix world. If your looking for something compatible with the evil empire your probably looking for samba. NFS works in a server client relationship. To use it you'll need to install the nfs server on the machine with the filesystem you want to access, and client programs on the client to utilize the share.
Server setup:
For starters, you'll obviously need to install a couple of packages. If you have nfs compiled into your kernel do an apt-get install nfs-kernel-server on the server. If you don't have it compiled into the kernel you can use the nfs-user-server package however it has slightly more overhead than the kernel-server. The stock debian kernel has nfs compiled in, and it's defautly selected in a new kernel, so unless you remember turning it off, it's likely compiled in.
After you have the server installed, you will want to secure things up a bit. Start by adding the following to your /etc/hosts.deny
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
This will stop anyone from connecting to the nfs services. However we will obviously want to allow someone to connect... In the /etc/hosts.allow add
ALL: 192.168.0.
Of course swap this out with the range or single ip that you want to allow to mount your shares. (you can't use hostnames for the portmaper so make sure you specify by IP)
Now that things are a little more secure you'll want to setup your shares. This is done by editing the /etc/exports file. You'll want to add a line that starts with the location of the directory you want to share, the hostname or ip of the machine you want to share it with, and then the access you wish to give the host in brackets. So for instance...
/home/user 192.168.0.13(rw,sync)
This would give read/write access to the /home/user directory to host 192.168.0.13. The sync option is default these days, but the debian package will warn you to tell you that it's setting it to sync if you don't specify it. After the share is setup your next step is to restart the nfs server. A simple /etc/init.d/nfs-kernel-server restart will do the trick.
Client setup:
So, once the server is setup it's just a matter of mounting the share on the client machine. To do this you'll first need to apt-get install nfs-common
Once that is installed you should be able to simply mount the share like so:
mount -t nfs server:/home/user /mnt
Where server is the name of the server machine (or ip), and the /home/user is the directory you shared in the /etc/exports file on the server. You will then be able to browse the /home/user directory on the server through the /mnt location. You can set this up in your /etc/fstab to make things easier as well. Simply add a line such as:
server:/home/user /home/user/server nfs defaults,user,noauto 0 0
A setup like this would allow the user to mount his home directory on the server in /home/user/server on his client machine. Of course, you can change this however you see fit by modifying the /etc/exports and setting up your fstab.
And so, that is about covers it. Any questions or troubles let me know.
-- eccentric
|