Linux‎ > ‎

SFTP

set umask for sftp

Create a shell file( note .sh extension) with your favourite editor(vi for me)

$ sudo vi /usr/lib/openssh/sftp-server.sh

Add the following lines:

#!/bin/bash umask 0002 /usr/lib/openssh/sftp-server

Set the execute permissions

$ sudo chmod +x sftp-server.sh

Edit the sshd_config

$ sudo vi /etc/ssh/sshd_config

Add .sh to the end of the Subsystem line(near the bottom of the file):

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

becomes:

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

Then restart sftp server

$ sudo /etc/init.d/ssh restart

(or possibly kill -HUP the sshd proc)


Comments