I want that users of my group who don't have sudo rights can mount a partition that is on a remote computer. Imagine a user has an account on several computers but a big chunk of data is lying on the hdd of a particular computer.
Is there a way that he can mount this partition on his current computer? Also the user should not be given any sudo rights.
Can I make an entry in /etc/fstab
that automatically mounts the remote partition in case a specific user logs in to the computer?
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 withshowmount -e
). Same should be true after each restart of the server.On each client, install autofs:
Edit the file /etc/auto.master to remove the comment sign from the line for /net:
After restarting the autofs service (
sudo service autofs restart
), you should be able to access the exported filesystem(s) viaEg., 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:
/net/myserver/myotherdata
/net/secondserver/moredata
without any action on the clientIf you do not want to always enter /net/...., just add a link in e.g. your home directory:
Caveat:
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.