Friday, February 15, 2013

linux scp and umask

I use CentOS 5.x
The problem is that if I use scp or sftp to copy a file on such CentOS server, the umask is not taken in consideration.
Behavior of scp and sftp is different.

Btw, a solution is to use openssh 5, but I don't like to alter the distribution, since CentOS 5 install openssh 4.

Using google I've found different solution (pam? etc.) but no one works for me.

So, a way to make what I want is:

For sftp

vi /etc/ssh/sshd_config
...
# override default of no subsystems
# Subsystem       sftp    /usr/libexec/openssh/sftp-server
Subsystem sftp /bin/sh -c 'umask 0002; /usr/libexec/openssh/sftp-server'

and restart sshd


And for scp

vi /home/myuser/.bashrc




adding (0002 or what you want)

umask 0002

No comments:

Post a Comment