You are not logged in.

#1 2015-05-14 17:18:50

xtian
Member
Registered: 2013-08-25
Posts: 179

mounting remote server directories with SSHFS identifying correct user

I'm using SSHFS to mount a local server. I don't recall having this problem before; however, my local user can't copy files after the directory is mounted. Reading the Wiki page, it is suggested this line be added to `fstab`:

USERNAME@HOSTNAME_OR_IP:/REMOTE/DIRECTORY  /LOCAL/MOUNTPOINT  fuse.sshfs noauto,x-systemd.automount,_netdev,user,idmap=user,transform_symlinks,identityfile=/home/USERNAME/.ssh/id_rsa,allow_other,default_permissions,uid=USER_ID_N,gid=USER_GID_N 0 0

Which translates to this line in my /etc/fstab file:

xtain@mrwizard.local:/ /mnt/mrwizard.local  fuse.sshfs noauto,x-systemd.automount,_netdev,user,idmap=user,transform_symlinks,identityfile=/home/mastershake/xtian/.ssh/id_rsa,allow_other,default_permissions,uid=1000,gid=1000 0 0

The command `$ sudo mount -a` is not mounting the volume. I can mount using the manual command `$sshfs xtian@mrwizard.local:/ /mnt/mrwizard.local`

The problem can be seen in the listing of the files owned by the user xtian:
[...]
    -rw------- 1  500  500       238 May 14 11:33 .Xauthority

Other than the problem of the mount command not working with fstab, Which UID, GID should be used in the fstab line? My local or remote ID for the same user?

----
ALSO, I just noticed this example at the bottom of the WIKI:

"Considering the following example settings ...

SERVER = Server host name (serv)
USER_S = Server user name (pete)
USER_C = Client user name (pete)
USER_S_ID = Server user ID (1004)
USER_C_ID = Client user ID (1000)
GROUP_C_ID = Client user's group ID (100)

this is the final SSHFS mount row in /etc/fstab;

pete@serv:/mnt/on/server      /nmt/on/client        fuse.sshfs      x-systemd.automount,_netdev,user,idmap=user,transform_symlinks,identityfile=/home/pete/.ssh/id_rsa,allow_other,default_permissions,uid=1004,gid=1000,umask=0 0 0

As you can see, the uid is set to the server's UID id (1004), and gid is set to... the client's UID (1000), and not (100) or whatever the server's user's GID is... %-/

Last edited by xtian (2015-05-14 17:33:34)

Offline

#2 2015-05-14 17:44:15

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: mounting remote server directories with SSHFS identifying correct user

I have noticed that sshfs will recognize the server's user, and use the server user's permissions, and won't change ownership of files transferred to the server's files.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#3 2015-05-14 23:33:15

xtian
Member
Registered: 2013-08-25
Posts: 179

Re: mounting remote server directories with SSHFS identifying correct user

How's that?
USER_S = Server user name (pete)
USER_C = Client user name (bob)  <--
?

The strange problem here is I'm logging in as xtian from xtian to xtian, but the server's files show up as UID/GID 500

Last edited by xtian (2015-05-14 23:34:27)

Offline

#4 2015-05-15 01:11:25

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: mounting remote server directories with SSHFS identifying correct user

Not a Sysadmin issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2015-05-15 05:16:49

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: mounting remote server directories with SSHFS identifying correct user

You create a pipe in which the user who mounts the sshfs has the credentials of the user they are logging into via ssh.  I'd be about the same as mounting a samba share.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#6 2015-05-16 13:37:04

xtian
Member
Registered: 2013-08-25
Posts: 179

Re: mounting remote server directories with SSHFS identifying correct user

@nomorewindows

A CLI pipe? I don't follow your meaning.

Offline

#7 2015-05-16 17:00:16

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: mounting remote server directories with SSHFS identifying correct user

It basically acts as a secure shell, and handles the permissions according to the server you are logging into to.  It doesn't try to match up the uids between the machines.  Anyone can mount the secure fs, and it "pipes" between who mounted the fs, and who's authentication applies on the other machine.  Another user can't tap the secure mounted fs, not even root (if root wasn't the mounter).


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#8 2015-05-16 18:25:49

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: mounting remote server directories with SSHFS identifying correct user

xtian wrote:

I can mount using the manual command `$sshfs xtian@mrwizard.local:/ /mnt/mrwizard.local`

According to the above your username is xtian, which it isn't in your fstab entry:

xtian wrote:
xtain@mrwizard.local:/ /mnt/mrwizard.local  ...

So without having looked for further errors nor knowing anything about sshfs, I would suppose to change this.

Sometimes simple spelling errors are actually the hardest to solve. – Like I always try to '#include <some_library.c>'.

Offline

Board footer

Powered by FluxBB