Default owner/permissions of created files via VSFTPD
772
How do I set the default values of directories and files created to be 775 ? My understanding is that I need to modify the umask on VSFTPD, but how do I know what to change it to?
In case you are wondering where to set your umask, it can be set in the vsftpd config file (/etc/vsftpd.conf) as anon_umask for anonymous access and local_umask for users.
For the mask to work properly (even without anonymous access) it seems necessary to set anon_upload_enable=YES and anon_mkdir_write_enable=YES. If these are not set, writing, reading and executing will not be allowed for groups or others on files uploaded via ftp (even though the standard privileges may be set for something else).
In your case, if you need user-authenticated access, you should set the following:
Here, file_open_mode sets the default setting of files. 777 makes it readable, writeable and executable for anyone. With local_umask set to 002, this gives you 775, as you requested.
Notica that local_umask defaults to 077, disabling groups and others to access files in any way (hence it is set here).
Umask and final permissions that you need should add up to 777. Since you need 775 permissions, you need 777 - 775 = 002 as umask.
In case you are wondering where to set your umask, it can be set in the vsftpd config file (/etc/vsftpd.conf) as
anon_umask
for anonymous access andlocal_umask
for users.For the mask to work properly (even without anonymous access) it seems necessary to set
anon_upload_enable=YES
andanon_mkdir_write_enable=YES
. If these are not set, writing, reading and executing will not be allowed for groups or others on files uploaded via ftp (even though the standard privileges may be set for something else).In your case, if you need user-authenticated access, you should set the following:
Here,
file_open_mode
sets the default setting of files.777
makes it readable, writeable and executable for anyone. Withlocal_umask
set to002
, this gives you775
, as you requested.Notica that
local_umask
defaults to077
, disabling groups and others to access files in any way (hence it is set here).Further reading: https://security.appspot.com/vsftpd/vsftpd_conf.html