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)

  • 2
    Perhaps you should (have) posted this update as an answer? – Ƭᴇcʜιᴇ007 Jun 28 '13 at 13:40
  • I've rolled back your question to contain just the question. Please post any solutions as answers to your own question. – James Mertz Jun 28 '13 at 15:07

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.

  • +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 Mar 12 '13 at 13:57
  • 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 Mar 12 '13 at 14:48
  • To avoid editing the .bashrc file for each and every user, you can try using the /etc/profile.d/ trick that I answered at superuser.com/questions/557430/…. – xpt Mar 12 '13 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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