19

As you can see below I'm able to map the user from kevcoder00 to kevcoder01 but the group gets mapped to marigold although that group does not exists on kevcoder01

l00py@kevcoder00:~$ sshfs -o idmap=user l00py@kevcoder01:/home/l00py ~/kevcoder01/
l00py@kevcoder01's password: 
l00py@kevcoder00:~$ ls -hl kevcoder01/
total 0
-rw-r--r-- 1 l00py marigold 0 Jul  4 00:34 I_LIVE
-rw-r--r-- 1 l00py marigold 0 Jul  4 00:59 I_LIVE_AGAIN

What do I need to do to map both user and group?

2 Answers 2

15

I don't think it's mapping to marigold. The GID that marigold is using on your local system is the same number as the default group of 100py on the remote server devcoder01.

For example

On my laptop my default group is GID 501, saml.

$ id -a
uid=500(saml) gid=501(saml) groups=501(saml),502(vboxusers),503(jupiter)

On my remote server skinner the user sam uses the following:

$ id -a sam
uid=5060(sam) gid=1000(users) groups=1000(users),1060(pics),1050(mp3s),1070(mock)

Now when I connect:

$ sshfs -o idmap=user sam@skinner:/home/sam /home/saml/mnt

$ ls -l ~/mnt
drwxr-xr-x 1 saml users     4096 May 27  2011 projects
drwxr-xr-x 1 saml users     4096 Mar 11 22:53 public_html
-rw-r--r-- 1 root root   1992744 Apr 18  2012 rest.war
-rw-r--r-- 1 saml  1000      136 Sep  4  2012 scott_jay_addresses.txt
drwxr-xr-x 1 saml  1000     4096 Jun 27  2012 SparkleShare

If you look in this directory it would appear that I have access to other groups but it's just the way that sshfs works. It's presenting the shared directory using the UIDs/GIDs of the remote and you happen to have the same UIDs/GIDs in use on your local system.

If you use the -n switch to ls -l you can see the actual UIDs/GIDs:

$ ls -ln
drwxr-xr-x 1 500  100     4096 Mar 11 22:53 public_html
-rw-r--r-- 1   0    0  1992744 Apr 18  2012 rest.war
-rw-r--r-- 1 500 1000      136 Sep  4  2012 scott_jay_addresses.txt
drwxr-xr-x 1 500 1000     4096 Jun 27  2012 SparkleShare

If I had an entry in my local system's /etc/group file for 1000 it would've been shown when doing the ls -l. In the above output you can see that the group "user" is using GID 100, and I just happen to have an entry in my local system's for that:

users:x:100:
1
6

Based on the situation (results of id -a) in slm's reply, perhaps you can try:

sudo sshfs -o allow_other,default_permissions,uid=500,gid=501 sam@skinner:/home/sam /home/saml/mnt
1
  • Not sure why we are using sudo here. By man sshfs It is recommended to run SSHFS as regular user (not as root). Commented Apr 13 at 19:01

You must log in to answer this question.

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