Linux and SSH Filesystem permissions


I find the SSH Filesystem to be a huge help when working with several computers at the same time.  I access my department’s storage as well as my network hard drive from anywhere.  Until today, sometimes I was unable to overwrite or delete files mounted by sshfs.  I realized that this was because by default, an sshfs mounted filesystem retains the userid and groupid of the remote owner.  So, if I have userid and groupid 1000 on my local filesystem but userid 1024 and groupid 2048 on the remote filesystem, I may have trouble writing stuff on the remote filesystem.  Linux sees that the userid and groupid are not my own, so I’m in trouble if the file I want to write to doesn’t allow others to write.

Looking here and here I found that you can mount a remote filesystem as a particular local user and/or group.  I modified my /etc/fstab accordingly so that all users of the “fuse” group can correctly mount my remote filesystem:

sshfs#username@remotehost:/remotedir /path/to/mountpoint fuse user,noauto 0 0

You can also specify a user or group id by replacing user with uid=xxxx,gid=xxxx.

, , , , , ,

  1. No comments yet.
(will not be published)