When attempting to update WordPress, you may be prompted to supply FTP credentials. FTP access is required when WordPress doesn't have the necessary permissions. This is resolved by making your web server (for example, Apache) the owner of this directory.
The following commands require super user access. If you're not currently logged in as root, you may need to run the following command:
$ sudo su
Login to your server and find the directory where WordPress is installed. In Apache, the default directory is /var/www/html. By default, all the files and folders will be owned by root. You can verify this by running the following command:
# ll /var/www/html
You should see output like this:
Run the following command to change ownership of this folder, and all subfolders and files from root to apache:
# chown -R apache:apache /var/www/html
After you run this command, verify that the ownership has changed by running the previous command again:
# ll /var/www/html
The output should look like the following:
You can now return to WordPress and perform updates without being prompted for FTP credentials.