I have a remote access to a server. There I have my umask set to 0007. I refer to my server name as "sme", my local name as "lme". So I do the following:

sme@server$ touch f1
sme@server$ ls -l f1
-rw-rw----  1 sme    0 Jun 16 18:46 f1

Now I go to my local computer:

lme@local$ umask
lme@local$ mkdir server
lme@local$ sshfs sme@server /home/sme /server/ -o umask=0000
lme@local$ touch server/f2
lme@local$ ls -l server/f2
-rwxrwxrwx  1 lme  1001     0B Jun 16 18:48 server/f2

First thing, I notice any user from my local has full permissions to f2. Why? I have a umask for other users set to 7, so file permission should be 0 for them.

Checking on the server side:

sme@server$ ls f2
-rw-r----- 1 sme 0 Jun 16 18:48 f2

With my loggin on the server, I don't have the execution permission set. My server group cannot write the file. Also, the owner of the file is not the local user "lme" but the server one, "sme". I then tried to specify my server user's uid and gid to sshfs after checking them:

# Get server user's id and group id
sme@server$ id
uid=1059(sme) gid=1001(server-group) groups=1001(server-group)

# Remount the server's root
lme@local$ umount server/
lme@local$ sshfs sme@server /home/sme /server/ -o umask=0000 -o uid=1059 -o gid=1001

lme@local$ touch server/f3
lme@local$ ls -l server/f3 
-rwxrwxrwx  1 lme  1001     0B Jun 16 18:50 server/f3


sme@server$ ls -l 
-rw-r----- 1 sme 0 Jun 16 18:50 f3

Specifying the uid and gid to sshfs did not change anything regarding the file permissions. Also, group owner is 0 on the server, whereas it is 1001 when listing it from the mounted point on local. Paradoxally, my local user sees every file rights set to all the files my server user created.

However I can see that, firstly, checking the file created from local to the server, that the name of the owner changes: checking from local on the mounted folder, the local user "lme" is the file owner, but checking from the server, the user "sme" has the ownership. Secondly, group permission set from local do not follow on the server side. Server group does not have the writing permission. Thirdly, the mask passed in argument to sshfs does not match neither the local user's nor the server user's.

I want my server's user and group to be able to access any file and folder the local user creates. I would like to know how to do that, and above all any explanation and/or documentation explaining how the umask works with sshfs. So far the little doc I found (other forum threads) have been more confusing than anything else.

  • 1
    The umask option for sshfs goes down to the underlying fuse layer where it's handled wrongly. afaict the advice is to avoid it. – Ralph Rönnquist Jun 17 '16 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.