How does local_umask and file_open_mode work?
I had some problems with the filepermissions when local users uploaded their files via vsftp to a server.
I wanted the files to have all 766 permissions. After a lot of trial and error I found out that I had to set the settings like this:
local_umask=011
file_open_mode=0777
But I don't know why this results in 766 permissions. Can anyone explain this?
Solution 1:
The vsftpd daemeon will create file permissions as 0777. From that, the local_umask
( 0011 ) is subtracted. The umask essentially removes the permissions you don't want users to have. This results in the user's file permissions to be set at 0766.
For more information, see this article about file permissions.
Solution 2:
The umask value is subtracted from the open mode setting. If you don't provide a custom umask value, the default one (077) is used, leading to a result you don't want.