sshfs is mounting filesystems as another user

Solution 1:

It's worth a try to explicitly set the UID/GID. This could be done, for example, using the sshfs options:

uid=$(id -u),gid=$(id -g)

or

uid=$(id -u someuser),gid=$(id -g somegroup)

See https://wiki.archlinux.org/index.php/SSHFS#Secure_user_access for more details.

Solution 2:

The complete command is

sshfs \
-o uid=`id -u username` \
-o gid=`id -g username` \
-o allow_other \
[email protected]:/target/folder \
/local/folder

it maps username's user_id and group_id to the mountpoint (so the mountpoint looks like that user's own). The allow_other allows others to use this mountpoint which is good if the root mounts the folder for someone else.

Alternatively you can use -o allow_root to let root there too.