sshfs: User/group permissions and mapping

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

sshfs: User/group permissions and mapping

Post by ^rooker »

Here are some notes about user/group permission mapping when mounting shares over sshfs.
By default, the uid/gid of the target system are used as-is and not converted or mapped to the connecting client system's users/groups.

In my setup, I wanted to connect from different clients (with different uids/gids), but normalize the permissions of the created files/folders on the sshfs-target to the sshfs-server's uid/gid of the account I'm connecting with.

Here's what my working fstab looks like:

Code: Select all

sshfs#REMOTE_USERNAME@target.server.example:/home/REMOTE_USERNAME/share /mnt/share fuse     noauto,defaults,idmap=user,uid=LOCAL_UID,gid=LOCAL_GID,allow_other,identityfile=/root/.ssh/privatekeyfile   0       0
This does the following:
  • Connect to SSH as "REMOTE_USERNAME" on target server "target.server.example"
  • Target share is in "/home/REMOTE_USERNAME/share"
  • Mounts it on client as "/mnt/share"
  • uid/gid on client mountpoint are: LOCAL_UID / LOCAL_GID (use local username/groupname)
  • SSH RSA keyfile is in "/root/.ssh/privatekeyfile"
  • Files/folders created over this mountpoint are owned by REMOTE_USERNAME/REMOTE_GROUPNAME on the target server

Client system information:
  • OS: Debian Jessie (64bit)
  • SSHFS: v2.5
  • FUSE library: v2.9.3
  • FUSE kernel interface: v7.19
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply