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:
This does the following:
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
- 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