3

I'm having a bit of a nightmare with file permissions on my web-server at the moment.

The server has Apache installed on it, which uses the user 'apache' from the group 'apache'. I have also installed FTP which uses the user 'ftp' from the group 'ftp'.

The 'ftp' user has access to a directory on the server called 'uploads'. This is owned by the 'ftp' user and the group 'ftp'. This is all working fine.

The problem...

There are scripts owned by the 'apache' user which needs to have RWX access to the same directory, 'uploads'. To try and achieve this I added the 'apache' user into the 'ftp' group and set the folder permissions to 775. This worked fine, but new files added by the 'ftp' user are always 744, allowing the 'ftp' users full access but only allowing the 'apache' user read access.

What I am looking for is the ability to always allow the 'apache' user RWX access to ALL files / folders in this directory. How do I set the default permissions for new files/folders to have a different permission? Or allow the group permissions to be RWX by default. Or have I missed something obvious??

Any help will be greatly received. Thanks, Ben

2
  • 3
    1. Belongs on ServerFault; 2. umask. Mar 28, 2011 at 17:22
  • So you're going to have uploads with execute permission set? Nice... What's the address? I promise I won't rootkit your server...
    – Daenyth
    Mar 28, 2011 at 18:58

1 Answer 1

2

You should try umask :

The umask (UNIX shorthand for "user file-creation mode mask") is a four-digit octal number that UNIX uses to determine the file permission for newly created files.

More information on the man page.

You can read this tutorial to understand how to use umask easily :

0

You must log in to answer this question.