The easiest would be to use an NFS Share (on the "server" machine) and the automounter (autofs) on the "clients".
I assume that NFS is installed on server and client according to the first comment from Dorian.
Say, the partition to share is on /mydata, add an entry to the file /etc/exports on your server:
(options depend on your requirements). After calling
sudo exportfs -a the partition should be exported (test with
showmount -e). Same should be true after each restart of the server.
On each client, install autofs:
sudo apt-get install autofs
Edit the file /etc/auto.master to remove the comment sign from the line for /net:
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
After restarting the autofs service (
sudo service autofs restart), you should be able to access the exported filesystem(s) via
Eg., if your server's name is "myserver" and the exported filesystem is "/mydata", you could enter
to see the contents of the directory.
There are a few advantages over having a static entry in /etc/fstab:
- The NFS share is only mounted when accessed, and will be unmounted after some time of inactivity. This saves a lot of ressources and network bandwidth.
- If you add a second share on your server (say "/myotherdata"), you do not have to add any entry on the client. Just access the path
- If you add a second server with another share (say "/moredata" on "secondserver"), the path will be
/net/secondserver/moredata without any action on the client
- You can use the same path (/net/...) on each client, even on the server itself, if you installed and configured autofs on the server.
If you do not want to always enter /net/...., just add a link in e.g. your home directory:
ln -s /net/myserver/mydata .
NFS matches users/groups via the UID/GID. So the "same" user has to have the same UID on all computers, which also holds true for the groups (GID). Otherwise, access rights are mangled/corrupted. There is no problem if you have a centralized user management.