0

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 Apache 2'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?

3
  • Issue 1 was resolved below... any thoughts on Issue 2? Jul 12, 2012 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, 2012 at 17:49
  • Thought about that... figure they were related though... but, good enough idea. I'll create a new questions. Thanks! Jul 12, 2012 at 17:54

3 Answers 3

1

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
1
  • 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. Jul 12, 2012 at 17:47
1

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

umask 002
0

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

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .