Problem: When users are placing files on a server with SFTP, the umask set in /etc/profile and sticky bits set on directories are ignored.
Solution: Modify /etc/ssh/sshd_config. Find the line near the bottom that looks like:
Subsystem sftp /usr/libexec/openssh/sftp-serverChange to the following, adjusting the umask as needed. This example sets permission to 664 for files and 775 for directories:
Subsystem sftp /bin/sh -c 'umask 002; /usr/libexec/openssh/sftp-server'
To fix it for SCP, you also need to add the following line to /etc/pam.d/login and /etc/pam.d/sshd
session optional pam_umask.so umask=0022
1 comment:
Excellent.
I only modify in /etc/pam.d/sshd and it work perfeclty.
My environment is chroot sftp and winbind AD authenticaiton.
Many thanks for this doc.
--Umakanta
Post a Comment