12

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?

3 Answers 3

18

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.

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

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.

-1

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

2
  • 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. Jun 6, 2017 at 2:15
  • Ok, @Scott, edited the answer. Jun 6, 2017 at 2:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .