When using the auto update feature to update wordpress to the newest version or to update your plugins, some peoiple ask why they have to enter ftp details when at times it does not ask.
The simple reason is that your httpd user does not own the website public folder and you also have to chmod your wp-content folder to 0777 or 0775 rather than the default 0755 just so you can use the image uploader. If you have root access to your server, you can easily fix that.
You need to find out which user apache is running as. But before that, just connect to yuor server using SSH client and type the following command on shell:
[root@server]# top
As you can see in the above screenshot, httpd is running as the user ‘www’. Your user may be different depending on your server configuration.
or use this command, it will show ‘apache’ processes running under which user:
[root@server]# ps aux | grep 'apache'
root 1323 0.0 0.0 254152 624 ? Ss 2012 3:30 /opt/apache2/bin/httpd -f /opt/apache2/conf/httpd.conf
daemon 6408 0.2 5.4 302856 55360 ? S 07:45 0:01 /opt/apache2/bin/httpd -f /opt/apache2/conf/httpd.conf
daemon 6451 0.2 4.4 291720 44868 ? S 07:47 0:01 /opt/apache2/bin/httpd -f /opt/apache2/conf/httpd.conf
Some of the common ones are daemon, nobody, www, or www-data. Just make sure it’s not root.
Most probably, as in the screenshot above, you will also see one httpd process running as root so it can bind to port 80, and also some sub-processes running as a different user.
having found out your apache user for the account. Now all we need to do here is chown our public folder to change the user to the same one as the webserver running under which is in our case ‘daemon’.
[root@server]# chown -hR daemon:daemon /var/mydomain.com/htdocs/wordpress/
Now if you ls -l /home again, you will see that the user folder is now owned by ‘daemon’ as well as all files and folders within it.
Now if you try to update the plugins or WordPress update automatically, It will now seamlessly upgrade without asking for your ftp details.
Hope that helps.
Cheers!