Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Mar 29 '11 at 0:41

This question came from our site for professional and enthusiast programmers.

3  
1. Belongs on ServerFault; 2. umask. –  Cat Plus Plus Mar 28 '11 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 '11 at 18:58
add comment

1 Answer

up vote 0 down vote accepted

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 :

share|improve this answer
    
Thanks, this has helped –  bpneal Mar 29 '11 at 9:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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