Originally posted by enigma_0Z
OK, I believe it's called NFS? I need to create some shared files between computers on a network...
It's easier to do as to explain.
First of all ensure you have NFS support. Ubuntu includes this from the shelf, but in Gentoo you will need to emerge it:
emerge -avt nfs-utils
There are some more related packages and many howto's tells you how to set them up, but don't bother trying to set this up as the RPC portmapper and
friends are enabled by default.
In Gentoo you will also need to take a glance at the kernel to see if it was build with NFS enabled, it should look like this:
runlevel0@soviet ~ $ cat /usr/src/linux/.config | grep NFS
If this is not so, you will need to rebuild the kernel. Use the handy Genkernel application.
If you are running Ubuntu, ensure first of all that the NFS server is not running:
Note that in Ubuntu the above can be called nfsd
instead of nfs
Once you are sure every thing is in it's place open your favorite editor (Vim, of course) and create/edit the file /etc/exports
# /etc/exports: NFS file systems being exported. See exports(5).
/usr/portage 192.168.0.2(rw,no_root_squash,async) 192.168.0.3(rw,no_root_squash,async)
This is my exported portage tree. The syntax is
exported_directory IP_1(options) IP_2(options) ...
On Gentoo if you build the NFS support as a module probe for it and (on both distros) enable NFS at startup or in the default runlevel depending on your preferences.
rc-update add nfs boot
I don't know how to do this in a Ubuntu specific way, but I'm quite sure it's already enabled.
Now start the NFS daemon:
Your NFS server is ready and serving.
On the client side, the only thing you have to do is putting an entry into /etc/fstab such as this:
192.168.0.1:/srv/portage /usr/portage nfs noauto,rw,rsize=8192,wsize=8192,nolock,_netdev 0 0
This is the syntax:
SERVER_IP:/path /local/path nfs options 0 0
tells mount not to try to mount it if the server is not available, this avoids delays at boot time.
avoids exclusive locks, specially important for better performance on networks with more than two machines
this makes that the NFS is not mounted at boot, you need to mount it yourself. You can skip this option if you want.
a little tweak which improves performance
mount read-write, this is up to you.
Now read the NFS and the mount man pages to get more info and tune your system to your likings.
I'd also like to ask another question...
If I've got a computer with a NFS share, can I go to another Unix/Linux/BSD machine and mount that share remotely (eg. over the internet)?
Yes you can. A secure approach is restricting the IP in exports or using an SSH tunnel to use NFS. another way is using iptables to stealth the NFS port 2049. A fast and easy way to do this is using Firestarter
and simply enabling this port and the client IP in the "stealthed ports" section.