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

All right... I have my server set up and I have 4 sites residing in /var/www/. Each site directory and the files underneath it are all root:www-pub according to this post:

What's the best way of handling permissions for apache2's user www-data in /var/www?

My user, cdog, is part of the www-pub, as directed by the above post and, after more research, I believe umask is set up properly.

Issues 1: Creating new files inside any of the /var/www/ directories gives me permissions

cdog:www-pub -rw-r--r--

all other files are

root:www-pub -rw-rw-r--

I was led to believe (according to above post) that any new files created would be the later.

Issue 2 Most of these directories, with permissions of

drwxrwsr-x

are Joomla directories. Logging into the Joomla back end gives me a whole bunch of unwritable directories, which isn't good for updating/installing extensions/plugins, etc.

First, why aren't my files being created with the correct permissions? Second, why are the Joomla directories not writable?

share|improve this question
    
Issue 1 was resolved below... any thoughts on Issue 2? –  westexasman Jul 12 '12 at 17:48
    
Try to keep one issue per question -- I suggest that you ask a new question and move your second issue there. –  mgorven Jul 12 '12 at 17:49
    
Thought about that... figure they were related though... but, good enough idea. I'll create a new questions. Thanks! –  westexasman Jul 12 '12 at 17:54

3 Answers 3

up vote 1 down vote accepted

The user's umask determines what permissions new files receive. When a file or directory is created the systems starts with the most permissive permissions (0666 and 0777 respectively), and then clears the bits specified in the umask. The default umask of 022 therefore causes the group and world write bits to be cleared, which is why you end up with 0644.

To create files with group write permission you need to change the umask to 002 (i.e. only clear the world write permission). This can be done in a specific shell session with umask 002, but this won't persist across sessions.

There are a number of ways to set the umask permanently. If the pam_umask PAM module is installed and configured, you can set this in /etc/login.defs:

UMASK   002

Otherwise you can set it in your shell initialisation scripts, either ~/.bashrc if you only want it to apply to your user, or /etc/bash.bashrc if you want it to apply to all users:

umask 002
share|improve this answer
    
This seemed to do the trick. I changed all references of 0002 to 002 and added umask 002 to my .bashrc file... files are now created and uploaded with the correct permissions. –  westexasman Jul 12 '12 at 17:47

Before working with the files, you need to set your umask.

umask 002
share|improve this answer

It looks like you're using www-pub, is that apart of the group www-data ?

share|improve this answer
    
Actually, www-data needed to be part of www-pub. That fixed it... was answered here: serverfault.com/questions/407234/… –  westexasman Jul 13 '12 at 21:35

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.