- Joined
- May 20, 2016
- Messages
- 149
- Points
- 28
Normally, when uploading files to a VPS via SFTP (port 22), for files work normally, we have to set permissions for the folder that contains the files. To save your time on this job, you can set the default permissions for SFTP, it is very simple, we just need to edit SFTP configuration file.
On Centos Server
Find:
Change to:
On Ubuntu & Debian Server
Find:
Change to:
Once the editing is complete, press Ctrl + x and select Y to save the changes. You need to restart sshd to take effect:
From now on, when you upload files via SFTP to VPS, will be set folder default permissions is 775, and the files will be set to 644 permissions.
Good luck!
Code:
nano /etc/ssh/sshd_config
Find:
Code:
Subsystem sftp /usr/libexec/openssh/sftp-server
Code:
Subsystem sftp /usr/libexec/openssh/sftp-server -u 0002
Find:
Code:
Subsystem sftp /usr/lib/openssh/sftp-server
Code:
Subsystem sftp /bin/sh -c 'umask 0002; exec /usr/libexec/openssh/sftp-server'
Code:
sudo /etc/init.d/vsftpd restart
Good luck!