Linux Permissions

Computer Guy
Computer Guy used Ask the Experts™
on
Hi!

Permissions issue:

I am using a debian webserver 100% ssh (no hosting control panel).

To Get WordPress downloaded - I used wget on my SSH username (not root - I do have sudo).

Then extracted it - went to install it and the installer could not write the wp-config file.

Couple of things:

the files are assigned to nobody:nogroup

URL structure is /var/www/domain.com/public_html.

Any thoughts on how to get the correct permissions?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2007

Commented:
What are the file perms?
Kent WSr. Network / Systems Admin

Commented:
Per instructions on WP, if you want the installer to write the config for you, you simply need to give your web user write perms to the wp-config.php file . Afterward it has updated the config file, it will "complain" until you set the perms back to non-writable (as it should). The alternative - just open the wp-config.php file and put in the appropriate settings yourself. This is really nothing more than the dbname, host, and db perms. Save, move on. The installer will detect you have a "good" config file.  

To get a good "wp-config.php" file, copy the included "wp-config-sample.php", give the appropriate database credentials you have setup for mysql (DB_NAME, DB_USER, DB_PASSWORD, DB_HOST), then save, and, most importantly, make sure you save it as file name "wp-config.php".

That's about all there is to it.
AS simple fix would be to run the command:

chmod 777 wp-config.php

This will allow read/write/execute by anybody.  It is however unsafe.

To correct the problem, you should find out what username your webserver runs as.  It is usually "apache" or "httpd".

If your http service is running as apache, your should make all the files owned by apache by running this command in the root web directory:

chown -R apache:apache *

(Change apache to whatever the name is your web service is running as).

From there, you can set the proper permissions on files.  To start with something safe you can do:

chmod -R 744 *

That should also allow you to write the config file as well.
Kent WSr. Network / Systems Admin

Commented:
Above comment is true, Apache only needs write access to the config file ONCE. After its created, you can safely change it to 440.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial