Set Default Permissions of SFTP Uploaded Files to 664

Question:  How can I set the default permissions of every file uploaded without the need to change the file permissions on the server after the upload?  I want all uploaded files to have permissions 664.

Answer: On most servers, the default file permissions should already be 664. To explicitly set the permissions to be used for uploaded files, then the SFTP server should be configured using the -u umask option in the sftp-server Subsystem declaration in ssh_config.

See https://linux.die.net/man/8/sftp-server

and see https://linux.die.net/man/5/sshd_config

 

Tags :