default file permissions for ftp uploads in ubuntu (vsftpd)

4

I followed this answer for setting default file permissions in my web root folder.

I am trying to set all files/dirs to 775 by default. This works fine when creating files within linux and also when creating files directly on the web root through the samba share but it doesn't seem to work when files are created on the windows disk and ftp'd over.

When I do this the file permissions are set as read/write owner only [-rw-------] so apache cant even read them.

My setup is that I'm running Ubuntu in a virtualbox with a Windows 7 host. I have a local directory on the host where I store the files and I ftp them to the Ubuntu machine using netbeans for testing.

When I ftp to the VM I am connecting as an authenticated user (the same one that owns the web root and everything in it - who is also in the same group as apache and this is the group all the files are part of).

How can ensure that files are created with 775 permissions when ftping? (I am using vsftpd)

SwiftD

Posted 2013-03-10T00:29:14.227

Reputation: 399

2Perhaps you should (have) posted this update as an answer? – Ƭᴇcʜιᴇ007 – 2013-06-28T13:40:29.657

I've rolled back your question to contain just the question. Please post any solutions as answers to your own question. – James Mertz – 2013-06-28T15:07:02.007

Answers

2

Here is the quick fix that satisfy all your requirements.

Setup a cron job, in which all you need to do is

chmod -R 775 /path/to/vsftpd

The cron job will kickin in whatever interval that you think necessary.

xpt

Posted 2013-03-10T00:29:14.227

Reputation: 5 548

+1 Thank you for your suggestion. I have managed to create the effect I wanted by applying a umask to a user account that I have setup for ftp. I think the cron job approach would cause me problems as I am ftping directly to /var/www and it would overwrite any permissions I deliberately changed within the web root but it's an approach i hadn't thought of and may well come in handy for other purposes. – SwiftD – 2013-03-12T13:57:22.283

Glad that you solve it on your own. Sorry that I sound offensive before, -- i had the feeling that the ftpd uploading is interfering with web files, but the OP was not quite clear, thus I asked. – xpt – 2013-03-12T14:48:35.710

To avoid editing the .bashrc file for each and every user, you can try using the /etc/profile.d/ trick that I answered at http://superuser.com/questions/557430/ubuntu-12-04-setting-etc-environment-variables/559690#559690. – xpt – 2013-03-12T14:50:53.243