I've been trying to set umask 002 to my sftp users, I already tried setting the umask in the following files:


  Subsystem sftp    /usr/libexec/openssh/sftp-server            #works
    #Subsystem sftp /usr/libexec/openssh/sftp-server -u 0002              #failed
    #Subsystem sftp /bin/sh -c ‘umask 0002; /usr/libexec/openssh/sftp-server’ #failed
    #Subsystem       sftp    /opt/sftp-server-wrapper.sh                      #failed
    #Subsystem   sftp    /bin/bash -c ‘umask 0002; /usr/libexec/openssh/sftp-server’ #failed


   (session    optional     pam_umask.so umask=0002)

I know that if you are using a newer version for OpenSSH you can use the '-u' option, so I tried to upgrade it but yum says that there is no newer version for OpenSSH and I don't want to install it manually haha because I don't know if at the this will resolve my issues.

Do you know how to set umask to sftp with OpenSSH 5.3?

Here are some details:

  • CentOS 6
  • OpenSSH 5.3

Thank you in advance!

P.S: I already tried the following recomendations withour results: OpenSSH 5.3 setting UMASK for SFTP chroot env, dosen't work at all

Increasing permissiveness/permissions for umask + openssh + chrooted SFTP server using internal-sftp

Ok guys here are some updates,

I tried to set the umask to /etc/pam.d/login too like this:

session    optional     pam_umask.so developers umask=0002

I restarted the sshd service after that but, nothing happened, everytime I login with my ftp account and upload a file I still got the rw-rw-r permissions.

I've been researching over the web about this issue but there is no info about this.

I just need to set the permissions or umask for my users to 775,

I would appreciated some help!

Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.