You are not logged in.

#1 2012-05-01 21:17:45

rwd
Member
Registered: 2009-02-08
Posts: 664

[SOLVED] sshfs ignores umask argument

I have a  server and a laptop where on both systems all users have umask 0007 as set in /etc/profile.

I mount the server from my laptop like this using a non-root account 'user1', which also exists on the server, though with a different uid:

sshfs -o idmap=user,follow_symlinks,reconnect,umask=0007 user1@192.168.1.5:/srv ~/network/sshfs/user1\@arch-server

When I create a file 'testfile' in it from my laptop I see this on the laptop as I expect:

-rw-rw----  1 user1 http    0 May  1 23:01 testfile

however when I check locally on the server I see:

-rw-r-----  1 user1 http    0 May  1 22:59 testfile

It seems as if the umask argument of sshfs is ignored. Any ideas how to change this?

Last edited by rwd (2012-05-07 21:20:55)

Offline

#2 2012-05-05 00:39:44

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: [SOLVED] sshfs ignores umask argument

when using sshfs the user does not "log in" normally (no shell is executed) therefore no /etc/profile is sourced. Instead of the shell an application set by the SFTP subsystem is executed (see below). Upon execution this application inherits it's umask from it's environment and it is this application that handles all files manipulation. You have to tell the application what umask to use and you have to tell it on server side as the client-side umask option in ssh is only propagated to login shells (simply put).

On the server edit /etc/ssh/sshd_config

find a line saying:

Subsystem sftp /usr/lib/openssh/sftp-server

and change it to

Subsystem sftp /usr/lib/openssh/sftp-server -u 0002

Put your desired umask in place of 0002.

-m.


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#3 2012-05-07 21:15:04

rwd
Member
Registered: 2009-02-08
Posts: 664

Re: [SOLVED] sshfs ignores umask argument

Thanks that works like a charm! In my case I'm using

Subsystem sftp internal-sftp -u 0007

as a workaround because in the past

Subsystem sftp /usr/lib/openssh/sftp-server

caused 'subsystem request failed on channel 0' errors. Maybe that that isn't needed anymore, I'll try out later.

Offline

Board footer

Powered by FluxBB