mkdir ~/mnt/2letter
echo PASSWORD | sshfs -o password_stdin www-data@localhost:/var/www/sites/2letter ~/mnt/2letter -o sshfs_sync,cache=no,password_stdin

After this:

$ ls -ld ~/mnt/2letter/
drwxr-xr-x 1 www-data www-data 4096 Jan 28 21:29 /home/porton/mnt/2letter/

I need to access /home/porton/mnt/2letter/ under my UID (porton) not as www-data, because I am not allowed by file system permissions to modify www-data owner files, but need to edit them.

Moreover it seems to have been working with the correct UID with older versions of Linux. Why doesn't it work now?

2 Answers 2


Try chucking in the two following options

-o idmap=user,uid=<YOUR UID>
  • Yes, it works, I need also to specify gid=XXX, but why does it works only with numeric IDs
    – porton
    Jan 28, 2013 at 21:18
  • 2
    You will have to ask the author(s) of sshfs that question :)
    – tink
    Jan 28, 2013 at 21:28
  • in order to discover the numbers behind your uid and gid, you can use the id command. With these numbers you can specifi exactly who is mounting and get the correct rights after that (id -u gives you your uid number and id -g your group (note: @Jeff why did you delete my answer, I consider is was very relevant as many users do not know how to get their id details - is this a place for experts only or for learning things !?)
    – splaisan
    Sep 20, 2019 at 9:20
  • @splaisan - are you sure you're talking to the right people? There's no Jeff in this thread ...
    – tink
    Sep 20, 2019 at 18:26
  • 1
    Well ... @splaisan - Jeff was right; as it stood your answer didn't address the question, it would have been a suitable addition to the comments in my response (as it addressed one of the comments here).
    – tink
    Sep 22, 2019 at 10:56

Based on @tink 's awnser, we can use uidfile and gidfile to specify multiple id mappings conveniently:

sshfs -o default_permissions -o nomap=ignore -o idmap=file -o uidfile=~/uidfile -o gidfile=~/gidfile $user@$dataServer:/home/groups/shared /home/$user/shared/

You may use the following to generate uidfile and gidfile (in the remote server of course):

cat /etc/passwd | cut -d: -f1,3 > uidfile
cat /etc/group | cut -d: -f1,3 > gidfile
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 23, 2023 at 9:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .