I found this here. It’s been brought here so that I don’t miss it.
In this small Tutorial I will show you how to set up a working directory / file share between two or more Ubuntu Linux Computers.
We’re gonna share the directory /media/music
on the Ubuntu Linux box ernie
, in order to allow the other Linux box bert
to access it and listen to ernie’s music, Let’s go!
1 – Setting up ernie
(who is sharing the directory):
Just Execute the following commands in a Terminal on ernie
- At first, we need to Install the Packages which are needed in order to share the files via NFS:
sudo apt-get install nfs-kernel-server
- Now, edit /etc/exports in order to share our music folder!
sudo nano /etc/exports
and add the line
# /media/music bert(ro,async,all_squash)
# the following worked for me where 192.168.0.0/16 is the IP range of the LAN
/media/music 192.168.0.0/16(ro,async,all_squash)ro means “read only”, so the others can not delete your files. If you wish to allow writing to this directory, use rw “read write” instead!
- Restart the NFS Server by executing
sudo /etc/init.d/nfs-kernel-server restart
- We’ve configured
ernie
very fast, didn’t we? Now it’sbert
’s turn
2 – Setting up bert
(who is using the directory):
Execute the following commands in a Terminal on bert
- Install the needed “NFS Common” Package nfs-common
sudo apt-get install nfs-common
- Create your a music directory which will contain ernie’s directory and which is located at /var/music:
mkdir /var/music
- Mount ernie’s shared music directory to /var/music:
sudo mount ernie:/media/music /var/music
- Now you can access the files from ernie in your local direcotry
/var/music
– Have Fun! - If you wish to mount the Directory automatically each startup, just just need to modify
/etc/fstab
:Open the file usingsudo nano /etc/fstab
and append
ernie:/media/music /var/music nfs r,hard 0 0
(Use rw,hard instead of r,hard in case you shared the File as “read write” or you won’t be able to change files!)
3 – We’re finished
Setting up basic File Sharing between Linux computers isn’t as hard as everybody is saying, and I really hope this will help some Linux Beginners out there to manage it on their own.