Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to force permissions on newly created files, similar to umask, but in reverse?

I already know I can kludge it with a cron job, but I am hoping that there is a better way.

The setup I'm working from is this: A vsftpd server, with no anonmyous logins. One group of users can upload or download, some (different group) can just download. I want to make it so when up-loaders create a file or directory, the permissions on the files they upload are changed so everyone in the same group (uploaders) can read or write, but the downloading users can only read the files.

Trouble is that vsftpd by default sets the permissions on the file to 0700, while I need 0775. It also only allows user and permission changes on anon user uploads.

Any thoughts?

share|improve this question
What's your file_open_mode in vsftpd.conf? – Daniel Beck Jun 3 '11 at 20:00
I have it set to file_open_mode=0775. I also tried using chown_uploads=yes, and chown_upload_mode=0750, however it turns out that is only relevant for anon uploading. – dynamphorous Jun 3 '11 at 20:05
Are you sure it's not the users' regular umasks that are this restrictive? – Daniel Beck Jun 3 '11 at 20:15
Well my system wide /etc/profile umask is 022, which isnt quite what I would want, but also wont set permissions of 0700 on newly created files. And those users dont have ~/bashrc files since their home directory is the FTP site they are chrooted in. And they dont seem to have created any hidden files or folders in the FTP directory. Could that be my problem? Do I need to set their shell using usermod and then set their umask to something less restrictive? – dynamphorous Jun 3 '11 at 20:35
up vote 3 down vote accepted

I think you should be able to set it with the local_umask config option. For what you are looking for, you would need to set local_umask=0002.

It has been a while since I have configured vsftpd, so I could be wrong.

share|improve this answer
I suppose this only works if you are using local users. Are you using local, or virtual users? – Kirk Jun 3 '11 at 20:30
I'm using local users, and it looks like you are exactly right. I didn't catch that the default umask is 077 if this is hashed out in the config file.... Now I feel like an idiot, but thank you very much for your help. You as well Daniel. You both helped me immensely! – dynamphorous Jun 3 '11 at 20:42
I would recommend that you specify all 4 of the bits in the umask. While it isn't required it is a best practice and the best way to ensure future operability with your existing configs. – Kirk Jun 3 '11 at 23:02

You must log in to answer this question.

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