Editing files remotely via sshfs

When accessing a remote host via sshfs there are two common problems when trying to edit files.

  1. UIDs/GIDs differ between your machine and the remote host. So permissions on the mounted filesystem are wrong.
  2. Files cannot be updated (e.g. saved from editors) for no apparent reason.

To address the first problem you can use the uid=… and gid=… options.
The second problem can be addressed with the workaround=rename option via sshfs.

To mount a remote location you can use the following command line.

sshfs -o uid=<local uid>,gid=<local gid>,workaround=rename <remoteuser>@<remotehost>:<path> <mountpoint>

For example if a user has uid 1000 and gid 1000 and wants to mount the /home/me directory on the remote server “myserver” to the local directory ~/mnt/me he could use the following command:

sshfs -o uid=1000,gid=1000,workaround=rename me@myserver:/home/me ~/mnt/me

Now files should have the correct permissions and saving (overwriting) files should work.

Tuesday, July 16th, 2013 Uncategorized

Leave a Reply