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?

westexasman
  • 135
  • 2
  • 7

3 Answers3

1

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

umask 002
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
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
mgorven
  • 30,036
  • 7
  • 76
  • 121
  • 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
0

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

Linztm
  • 381
  • 2
  • 7
  • Actually, www-data needed to be part of www-pub. That fixed it... was answered here: http://serverfault.com/questions/407234/apache-server-joomla-files-in-var-www/407248#407248 – westexasman Jul 13 '12 at 21:35