Score:0

VSFTPD default permissions for new files vs new directories

pk flag

I'm running vsftpd and have a specific question:

The file_open_mode and local_umask options let me configure, what permissions a newly created file/folder should have.

The problem: I want 0660 for new files but 0770 for new folders (All files and folders should be readable and writable by owner and group - folders need the executable bit so that it's possible to open them)

How can I configure that?

(I searched this forum, google, vsftpd.man page, tutorials, manuals..)

Score:2
cn flag

TL;DR:

The default file_open_mode of 0666 and local_umask of 0007 will give you file permissions of 0660 and directory permissions of 0770.

File permissions

As you already pointed out, files are created with the permissions set in file_open_mode (modified by the local_umask). Therefore, to get files created with 0660 you can keep the default file_open_mode and modify it with a local_umask of 0007 to get 0660 as the result.

Directory permissions

Directories are created with mode 0777 modified by the local_umask. The only supporting documentation I found about this is in the source code itself. As there is no official browser-readable source code available, I can only link to an unofficial source code mirror at https://github.com/dagwieers/vsftpd/blob/3.0.2/postlogin.c#L1179 where the "tunable umask" in the comment refers to the local_umask configuration.

  /* NOTE! Actual permissions will be governed by the tunable umask */
  retval = str_mkdir(&p_sess->ftp_arg_str, 0777);
Florian Metzger-Noel avatar
pk flag
Great - works like a charm. I'm astonished, that this essential parameter is not described in the manuals.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.