WordPress not Updating – Asking for FTP Details – Fixed
I was asked to have a look at a particular problem on a WordPress site, where nothing was auto updating at the click of the appropriate button, it was going and asking for FTP details that we didn’t have and shouldn’t have even needed.
Firstly I made sure that the wp-content director had permissions as 755, it did, and still not working.
It transpires that there was another problem in that the directories were not owned by process running Apache.
Logon to your Ubuntu box via SSh.
Type in the following:
ps aux | grep ‘apache’
You should be looking at something like this:
root@ubuntu-box:/# ps aux | grep ‘apache’
root 2233 0.0 2.3 44900 12032 ? Ss Jul21 1:37 /usr/sbin/apache2 -k start
www-data 3536 0.0 6.1 66468 31244 ? S Aug12 0:08 /usr/sbin/apache2 -k start
www-data 4043 0.0 6.3 66884 32512 ? S Aug12 0:11 /usr/sbin/apache2 -k start
www-data 4376 0.0 5.6 64156 28832 ? S Aug12 0:07 /usr/sbin/apache2 -k start
www-data 5205 0.0 6.4 67988 32892 ? S Aug12 0:10 /usr/sbin/apache2 -k start
www-data 7051 0.0 5.5 63664 28272 ? S Aug12 0:04 /usr/sbin/apache2 -k start
www-data 9724 0.0 6.4 68040 32884 ? S 05:41 0:02 /usr/sbin/apache2 -k start
www-data 10130 0.0 4.7 60648 24204 ? S 06:28 0:00 /usr/sbin/apache2 -k start
www-data 10554 0.0 5.4 63600 27780 ? S 07:32 0:01 /usr/sbin/apache2 -k start
www-data 10968 0.0 1.0 44900 5576 ? S 08:34 0:00 /usr/sbin/apache2 -k start
www-data 10992 0.0 1.0 44900 5332 ? S 08:35 0:00 /usr/sbin/apache2 -k start
This will tell us who the Apache service is running as, in our case it’s running as www-data user. Now we need to know the UID of the user, type in:
id www-data
You should see something like:
root@ubuntu-box:/# id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Excellent, we’ve got all we need, now we need to update the permission WordPress is using with the chown command, like this:
chown -hR [user]:[group] /path/to/http/directory
So:
chown -hR www-data:www-data /var/companya.com/httpdocs
Or:
chown -hR 33:33 /var/companya.com/httpdocs
Leave that command to run, and you’re all done. Log back onto WordPress, and update freely.
1 Comment
[…] make sure that the WordPress permissions are comfortable. chown -hR […]