When you first create an instance of WordPress on your own server, you may run into issues relating to file permission and ownership. When you attempt to add media, install plugins, or update the core, you will be brought to a screen requesting the ftp credentials for your host.
A common terrible advice solution for this issue would be to set your folder permissions to 777. This will in fact solve the problem, but it will also create a security hole large enough to drive a dump truck through. I recommend never doing this.
The better way to deal with this is through both permissions and ownership. The ideal permissions setting for your wp-content directory is 655. This can be accomplished through the following command:
#chmod -R 655 /var/www/html/wp-content
Parsing this out: the commend is chmod or “change modify”, the -R flag tells the command to act recursively, the 655 is the permission level, and the last part is of course the directory to which to the command is being applied.
The next step is to change ownership. Note this will not affect your ability to edit these files, as root will always have permissions, but it will allow wordpress to do its job. Since we want to be able to update the wordpress core itself in addition to media, plugins, and themes, we will apply this change to the root directory of the site.
#chown -R apache /var/www/html/
Now when you go back into the backend of your site you will be able to do all of your upload and installation tasks without a problem.