I know there are a lot of questions on this, but nothing worked for me. So I have a ftp server on Ubuntu 4.8 with sshd enabled. I would like to have write permissions for the group of the owner on every file uploaded.

Right now the permissions of the folder are: drwxrwxr-x And every file uploaded have the permissions -rw-r--r--

What I have tried but doesn't change anything at all (using FileZilla 3.21.0 or sftpd command directly on Mac):

  • setting local_mask=0002 in /etc/vsftpd.conf
  • setting Subsystem sftp /usr/lib/openssh/sftp-server -u 002 or Subsystem sftp /usr/lib/openssh/sftp-server -u 0002 in /etc/ssh/sshd_config

I did restart vsftpd and sshd, but still have only read permissions for the group. What is the reason for this?

  • What do you mean by "Ubuntu 4.8"? – Michael Hampton Aug 29 '16 at 10:01
  • @MichaelHampton Linux version 3.13.0-92-generic (buildd@lgw01-52) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) ), just in case this helps... – Guillaume Aug 30 '16 at 1:22

The SFTP protocol includes an operation for the client to set attributes for files on the server. This means that SFTP clients can set permissions on uploaded files, regardless of the umask.

I can think of three ways to accomplish what you want:

  1. Ask the remote user to set his client to disable setting permissions on uploaded files, assuming that's possible. For example, you can see a setting for that in this WinSCP dialog.

  2. Set up an automated process on the server to sweep the directory containing these files, and adjust permissions on any newly uploaded files.

  3. Disable the SSH_FXP_SETSTAT operation in the SFTP server. For the OpenSSH server, you'd have to alter the source code for the sftp-server program. There are commercial SSH/SFTP solutions on the market, and one of them may permit disabling this feature.

  • thanks for confirming all of this, I am going to go with changing the permissions automatically on the server – Guillaume Sep 2 '16 at 2:14

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.