3
1
I am setting up a file server where users log in via SFTP. I want all users to have the same permissions to read and write any file. Since they all have different accounts with different passwords, i end up with something like this:
-rw-r----- 1 user1 sharing 308 Jul 6 12:03 test2.rtf
-rw-r----- 1 user2 sharing 308 Jul 6 12:16 test3.rtf
The group is called sharing
which contains all the users. The problem is when files are written, the default permission for groups is read only.
I have tried setting the umask in sshd_config
:
Subsystem sftp /bin/sh -c 'umask 0002; /usr/lib/openssh/sftp-server'
Match Group sharing
ChrootDirectory /files/
ForceCommand internal-sftp -u 002
AllowTCPForwarding no
X11Forwarding no
The facl for the directory is this:
# file: .
# owner: root
# group: sharing
# flags: -s-
user::rwx
group::rwx
group:sharing:rwx
mask::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::---
also in these places:
init.d/rc:umask 002
init.d/ssh:umask 002
bash.bashrc:umask 002
If I log in via SFTP, i get permissions of 640. If I disable the sftp and log in as user1 via ssh, and touch a new file, i get permissions of 660 - which is what i want.
So how can I get this to work via SFTP?
This is debian 7 btw.
Try the ssd_config syntax over at http://serverfault.com/questions/70876/how-to-put-desired-umask-with-sftp
– ssnobody – 2015-07-06T19:43:10.680yep, i tried that one as well - no luck – DAB – 2015-07-06T21:31:01.817
Possible duplicate of Centos Sftp Ssh - How always create files with rwx-rwx-r-x and always owned by a certain group
– Jakuje – 2016-04-18T12:48:57.160