I would like to use sshfs with many users.
sshfs root@192.168.56.100:/ root/
With this command I get the whole file system in the directory root/.
Is there any possibilities to change the user of a file when this user just exists on the remote machine ?
I tried:
chown myuser myfile
When I make ls -lah
on the remote I get:
-rw-r--r-- 1 otheruser root 0 Jan 11 11:03 myfile
Best Answer
The problem comes from the fact that
chown
will give the file to the user whose local UID belongs tomyuser
.Say for example, on the local machine, you have
myuser
with UID 1001, but UID 1001 belongs tootheruser
on the distance machine.If you wanted to give it to
myuser
on the remote system, you would have to either:myuser
(using e.g.ssh root@distant id -u myuser
) and usechown
with that UID.Using the second option, you could do for example (using bash):