I have two machines A
and B
on my local network (both Ubuntu 21.10).
On machine A
I have a drive only for data (music, photos, films, documents, etc) mounted on /media/data
. Every user (there are 2) on the machine can read/write drive content.
I need to be able to do the same from my machine B
(where there is only one user), meaning read/write access.
In this case what is the appropriate method in order to achieve that ? considering that :
- I need user from machine
B
to not create permissions issues to users of machineA
- I need my programs from machine
B
to have correct permissions to read/write to the drive
Those two needs have not been quite met with the previous setup that I have tried. This is why I specify this. Though they might have not been met because my setup was not correct... I don't know. I've been learning and trying things out for the past year.
So here is what I have already tried :
sharing via Samba local network share --> access to files (playing music for example) was slow
sshfs :
- I never managed to set it up correctly to automount on startup
- I have permissions problems. For example : when using beets (to manage my music library), beets creates folders/files which are owned (on machine
B
) by a user listed as#user 1001
. This user is unknown from the system but it is theuid
of the user I ssh with on machineA
(and it is different from myuid
on machineB
) and I don't have permissions to modify anything (ownership, delete file, etc). I didn't manage to solve this so the sshfs solution is not acceptable as is for my use.
NFS : I just tried out today and didn't manage to pass a
mount.nfs: access denied by server while mounting (null)
error
So now I decided to stop trying things because I'm a bit lost and don't really know what I should actually try : better understand sshfs to solve permission problems ? make NFS work ?... and decided to ask for help :)
Until now using sshfs has been the best solution for me (access to files is fast and stable) but without solving these permission problems it's not good enough, and also if I could correctly set up automount on startup it would be even better...
Thanks for your help !
Edit
Concerning NFS this is what I did :
- install
nfs-kernel-server
on machineA
- install
nfs-common
on machineB
- added line
/media/data 00.00.00.00(rw,sync,no_subtree_check)
(with the IP address of machineB
) in/etc/exportfs
of machineA
- ran
sudo exportfs -a
- I checked the modification with
sudo exportfs
- I allowed nfs in the firewall (ufw)
- I checked that I could see the export from machine
B
withshowmount
and I could see it - When trying to mount the folder with
sudo mount 00.00.00.00:/media/data ~/data
(with IP address of machineA
) it returnsmount.nfs: access denied by server while mounting (null)