1

Here's my situation: I'm setting up an Ubuntu 14.04 web server for a team to share. I'd like the team to have read/write access to everything inside var/www/html (same as CHMOD 775 on every file and folder).

My issue is that SFTP clients on the Mac (Transmit, Cyberduck, and FileZilla) don't respect the default permissions I've set up.

After several hours, I've walked through many steps to accomplish my goal:

Set up team permissions:

  1. Created a myteam group
  2. Added all users to the myteam group
  3. Changed the group ownership of /var/www/html to myteam

At this point, ls -la of /var/www returns

drwxrwsr-x 2 marcelo myteam 4096 Jul 20 13:29 html

Set a default UMASK:

  1. Updated /etc/ssh/sshd_config with Subsystem sftp /usr/lib/openssh/sftp-server -u 002 based on this article.
  2. Updated /etc/pam.d/sshd and /etc/pam.d/login with a new line session optional pam_umask.so umask=0027 based on this question
  3. Updated /etc/pam.d/common-session/ with a new line session optional pam_umask.so and edited /etc/login.defs to change the UMASK line to UMASK 002 based on this question
  4. Rebooted all appropraite services and/or rebooted the entire machine

At this point, if I SSH into the server via a shell, the umask command reports 002, and all new files and folders have the correct permissions. However, if I SFTP into the server via Transmit, Filezilla, Cyberduck, etc. and create files or folders, it does not respect and defaults files to rw-r--r-- and folders to rwxrwsr-x (the folders are correct). I checked, and the FTP clients are not overriding any permissions - those are disabled.

1 Answers1

1

This is evergreen problem and it was discussed many times. I wrote short answer here:

https://superuser.com/questions/937003/setting-default-group-permissions-via-sftp/937735#937735

Basically you answered yourself using your last comment. SFTP preserves original permissions and truncates umask from it.

Jakuje
  • 10,363