sshfs: User/group permissions and mapping

Step-by-Step descriptions of how to do things.

sshfs: User/group permissions and mapping

Postby ^rooker » Wed Jul 12, 2017 5:03 pm

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
  • 0

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!
User avatar
Site Admin
Posts: 1444
Joined: Fri Aug 29, 2003 8:39 pm
Reputation: 0

Return to HowTo's

Who is online

Users browsing this forum: No registered users and 3 guests

Who is online over last 24 hours

Users browsed this forum in the last 24 hours: No registered users and 30 guests

Reputation System ©'