Solved Need help with permission

Hello everyone,

My problem is really basic and I should really be able to know the answer by now but I cannot figure it out.

I use the www/hiawatha web server and my www/hiawatha user is www.
the web directory is own by www
Code:
cd /www
ls -la
drwxr-x---  3 www  www  3 Jan 20 15:19 mydomain_fr/
cd mydomain_fr/
ls -la
-rw-r-----  1 www  www  0 Oct 15  2013 .htaccess
-rw-r-----  1 www  www  958 Nov  7  2013 favicon.ico
-rw-r-----  1 www  www  418 Nov  4  2013 index.php
-rw-r-----  1 www  www  19929 Nov  4  2013 license.txt
-rw-r-----  1 www  www  7185 Nov 21 08:41 readme.html
drwxr-x---  2 www  www  4 Jul 25 15:25 scripts/
-rw-r-----  1 www  www  4892 Nov  4  2013 wp-activate.php
drwxr-x---  9 www  www  89 Jan 24  2014 wp-admin/
-rw-r-----  1 www  www  271 Nov  4  2013 wp-blog-header.php
-rw-r-----  1 www  www  4795 Nov  4  2013 wp-comments-post.php
-rw-r-----  1 www  www  3814 Nov  4  2013 wp-config-sample.php
-rw-r-----  1 www  www  59 Jan 20 15:20 wp-config.php
drwxr-x---  8 www  www  9 Jan 21 11:15 wp-content/
-rw-r-----  1 www  www  2932 Nov  4  2013 wp-cron.php
drwxr-x---  12 www  www  123 Jul 25 15:25 wp-includes/
-rw-r-----  1 www  www  2380 Nov  4  2013 wp-links-opml.php
-rw-r-----  1 www  www  2359 Nov  4  2013 wp-load.php
-rw-r-----  1 www  www  32847 Nov 21 08:41 wp-login.php
-rw-r-----  1 www  www  8235 Dec 16  2013 wp-mail.php
-rw-r-----  1 www  www  10880 Dec 16  2013 wp-settings.php
-rw-r-----  1 www  www  25665 Dec 16  2013 wp-signup.php
-rw-r-----  1 www  www  4026 Nov  4  2013 wp-trackback.php
-rw-r-----  1 www  www  3015 Nov  4  2013 xmlrpc.php

Now, my FreeBSD user is called webmaster.
When I ssh to the web server as webmaster I cannot modify any of the files owned by www. This is despite adding webmaster to the www group.
cat /etc/group
Code:
wheel:*:0:root,webmaster
daemon:*:1:
kmem:*:2:
sys:*:3:
tty:*:4:
operator:*:5:root
mail:*:6:
bin:*:7:
news:*:8:
man:*:9:
games:*:13:
ftp:*:14:
staff:*:20:
sshd:*:22:
smmsp:*:25:
mailnull:*:26:
guest:*:31:
bind:*:53:
unbound:*:59:
proxy:*:62:
authpf:*:63:
_pflogd:*:64:
_dhcp:*:65:
uucp:*:66:
dialer:*:68:
network:*:69:
audit:*:77:
www:*:80:webmaster,ossec,webmaster
hast:*:845:
nogroup:*:65533:
nobody:*:65534:
webadmin:*:1001:www
git_daemon:*:964:
ossec:*:966:www

Could someone please point the obvious problem to me.

Thank you

Fred
 
Set the owner of the files to the webmaster user: chown -R webmaster mydomain_fr. The web server needs to be able to, at least, read the files. There are two ways to do this, you can either assign the group www to the files and give the group read access or you can make the files "world-readable", i.e. everyone, including www will be able to read them. The first chgrp -R www mydomain_fr. The second would be a little more difficult as you have to set different permissions for files and directories. This will do that, for directories: find mydomain_fr -type d -exec chmod o+rx {} \;. For files: find mydomain_fr -type f exec chmod o+r {} \;.

What you usually see is a group named 'webmasters' for example and the group has write permissions. Every member of the 'webmasters' group will be able to write there. Useful if there's more than one developer. The web server will function just fine if you set files as "world-readable". The owner of the file(s) will be set to whomever created them.

Do not change the membership of the www user or group. That's going to bite you some day.
 
SirDice ,
In wordpress the www web server user need to have read/write access to the /wp-admin directory.
I have adopted the first methode you provided
chown -R webmaster mydomain_fr and chgrp -R www mydomain_fr, how can I give the web server user write permission to /wp-admin?
 
SirDice ,
In wordpress the www web server user need to have read/write access to the /wp-admin directory.
I have adopted the first methode you provided
chown -R webmaster mydomain_fr and chgrp -R www mydomain_fr, how can I give the web server user write permission to /wp-admin?
A chmod g+w wp-admin should do the trick.
 
Back
Top