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

I have a server which has all of its users under their own user:group for example the user somename has a folder /home/somename and is chowned somename:somename.

Now, it seems that this user has a problem updating their Wordpress from the web and it keeps on asking for FTP details. I've traced the issue into the fact that www-data doesn't have access to the users files.

http://ardeearam.com/solved-wordpress-asking-for-ftp-credentials-when-upgrading/
...sudo chown -R www-data wordpress/... 

How do I allow or add www-data into somename privileges?

share|improve this question
    
Where are their wordpress files located? I assume in some directory under their home directory, but the ideas I have depend on a specific directory location. –  dafydd Dec 27 '12 at 17:18
add comment

1 Answer 1

In the 1970's world of /etc/passwd and /etc/group security, only a uid (user) can belong / be added to a group, no nesting is supported, but you could run something along the following lines, as a work around (assumes the wordpress directories are off the users home):

sudo bash
ls -d /home/* | xargs chmod o+rx
find /home/ -type d -name 'wordpress' | xargs chgrp -R www-data
find /home/ -type d -name 'wordpress' | xargs chmod -R g+rw

Which has the side effect of allowing all users to look in the home directory of any other user.

Alternatively you could add the wwwrun user id (change to suit) to the personal group of every user with a wordpress directory e.g.

sudo bash
for wpDir in `find /home -type d -name 'wordpress'`
do 
  chgrp -R www-data $wpDir && chmod -R g+rw $wpDir
  wpUser=$(echo $wpDir|sed 's:/[^/]*/\([^/]*\)/.*$:\1:')
  grep $wpUser /etc/passwd > /dev/null && ( usermod -a -G $wpUser wwwrun; chmod g+rx /home/$wpUser)
done
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.