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?

up vote 10 down vote accepted

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.

  • 2
    Yes I got that, I know the trick. But how does this work? Why can't I set just 766? – OrangeTux Jun 25 '12 at 22:37

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.

You are getting this permission because:

1) Setting local_umask=011 you tell to the vsftp to set:

0: read, write and execute 1: read and write 1: read and write

That is equal to chmod 766.

2) The value of file_open_mode=0777 are not parsed,

Here you can found a very good explanation of what are umask and how to use it: https://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html

  • This is not an answer to the question. (1) The OP wants files protected 766, not 666, so you are addressing the wrong scenario. (2) The OP has a configuration that works.  The question is asking why it works.  You have not addressed that. – Scott Jun 6 '17 at 2:15
  • Ok, @Scott, edited the answer. – Fernando Kosh Jun 6 '17 at 2:41

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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