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?
Answer
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
No comments:
Post a Comment