How can I change the umask for ssh and sftp in debian squeeze.
I have changed the umask from 022 to 002 in
/etc/profile and
/etc/login.defs
and modified
Subsystem sftp /usr/lib/openssh/sftp-server to
Subsystem sftp /usr/lib/openssh/sftp-server -u 002
in /etc/ssh/sshd_config
Everything seems to work when I am connecting through a shell, but I am still getting the wrong permissions when uploading files with through . Do you have any idea of how I can fix that issue?
I manged to solve the issue by following How to setup ssh's umask for all type of connections
Added:
# Setting UMASK for all ssh based connections (ssh, sftp, scp)
session optional pam_umask.so umask=0027
in /etc/pam.d/sshd
and /etc/pam.d/login
I also reverted to
Subsystem sftp /usr/lib/openssh/sftp-server
in /etc/ssh/sshd_config
Best Answer
Create a wrapper script which sets the correct umask and execute that as instead of sftp
Modify the sshd_config
Your sftp-server location may vary.