If you shares files between Linux boxes one of the easiest ways to do this is by using NFS. I thought this quick guide for setting up an NFS network might be useful. This might not be the best or only way of doing it but this works for me.
Server Settings
First off you need to configure the machine that's going to act as the server by doing the following (you need to be root for this):
1. Install the NFS packages using yum:
2. You now need to set up your /etc/exports file with details of the directory you want to share, who is allowed to share it, and permissions. So:Code:yum install nfs-utils nfs-utils-lib portmap system-config-nfs
Then add an entry similar to the one below, and save and close:Code:gedit /etc/exports
The first part is the directory I want to share, the second the IP address of the client who is allowed to access the directory, and the part in brackets allows read/write access and root access on the server (the no_root_squash entry is optional)Code:/home/admin 192.168.2.30(rw,no_root_squash,sync)
Note: if you prefer a gui and you're using Fedora as a server you can configure the exports file from the Desktop>Administration>Server Settings>NFS menu.
3. Now edit your hosts.allow file:
Paste in the following but change the IP address to the IP address of the client who will be allowed to access the server, in my case 192.168.2.30Code:gedit /etc/hosts.allow
Save and close.Code:portmap: 192.168.2.30 lockd: 192.168.2.30 mountd: 192.168.2.30 rquotad: 192.168.2.30 statd: 192.168.2.30
If multiple clients can access the server separate IP addresses with commas.
4. Now edit your hosts.deny file:
Paste in the following:Code:gedit /etc/hosts.deny
This prevents all hosts not listed in hosts.allow from accessing the server.Code:portmap: ALL lockd: ALL mountd: ALL rquotad: ALL statd: ALL
5. Open the Desktop>Administration>Security Level and Firewall menu. Select the Firewall Options tab and open the "Other Ports" dialogue. Use the "add" button to add the following:
2049 UDP
2049 TCP
111 UDP
111 TCP
Click OK.
Note: if you run FC4 there's a blank line called other ports. Just enter 2049:tcp,2049:udp,111:tcp,111:udp and hit OK.
6. The next step is exporting the directories you want to share and starting the NFS services. To start the nfs services type the following command into a terminal (as root):
Then export the directories from /etc/exports:Code:chkconfig nfs on
Reboot and the services will start automatically.Code:exportfs -ra
Client Settings
Setting up the client side of NFS is fairly straightforward. I'm not sure whether it's absolutely necessary to install all the NFS packages for the client but I always do, as I might want the client to act as a server if I'm working on another machine. So the steps I follow are:
1. Install NFS packages:
2. Open the folowing ports in the firewall:Code:yum install nfs-utils nfs-utils-lib portmap system-config-nfs
2049 UDP
2049 TCP
111 UDP
111 TCP
3. Create a mountpoint for the NFS share (as root):
and set permissions so that you can access this mount point as a user:Code:mkdir /media/admin
4. Add an entry to fstab:Code:chmod 777 /media/admin
Paste an entry at the bottom of the file that looks something like this:Code:gedit /etc/fstab
The first part is the IP address of the server and the directory that will be accessed. Dont forget to adapt the entry for your settings.Code:192.168.2.5:/home/admin /media/admin nfs noauto,rw,user 0 0
Save and close gedit.
5. As root type:
7. Make sure you can see the running services on the server by typing:Code:mount -a
If you can, move on to the next step.Code:rpcinfo -p 192.168.2.5 (the IP address of the server).
6. To mount the share type:
The share should appear on your desktop and you can access it like any ordinary directory.Code:mount /media/admin
I think that's it but apologise in advance if I've missed any key steps. Enjoy!
Update: a quick note on IP addresses. In theory you can use host names but I've never managed to get this to work. I have a Belkin router that automatically assigns IP addresses by DHCP but I found that it was relatively straightforward to change this so that all my boxes had static IP addresses. You will need to do this otherwise your settings will have to be changed every time an IP address changes.