Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
share|improve this question

1 Answer 1

Create a wrapper script which sets the correct umask and execute that as instead of sftp

#!/bin/bash
umask 002
exec /usr/lib64/misc/sftp-server

Modify the sshd_config

Subsystem       sftp    /usr/local/sbin/sftp-server.sh

Your sftp-server location may vary.

share|improve this answer
    
Thank you for the answer. I managed to solve the issue before you got to answer so I am giving you and upvote for the effort. Thanks for helping out but I am not going to try your solution since I already got it to work. (I had to few points to give you an upvote :( sorry) –  user68802 May 20 '11 at 7:17
    
@user68802 What's your final solution then? You should add it here. –  Vasilis Lourdas Jun 25 at 6:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.