file permissions

hello. newbie here that has exhausted attempts to fix a file permissions error.

im running LAMP w/ Ubuntu 12.04 and then followed guides for installing WP.

but I skipped the part where immediately after WP installation I reset file permissions and ownership of files as stated in the "configure wordpress" section of the linode "manage web content with wordpress guide".

so now when I upload media I receive an error on the WP gui stating:

imagefile.jpg has failed to upload due to an error

Unable to create directory wp-content/uploads/2014/02. Is its parent directory writable by the server?

so i have been going back in and trying out all the file permission modifications such as chmod and chown 755 777 commands in terminal (see link below) and it isn't working out for me. I'll be getting errors like "no such file or directory".

http://codex.wordpress.org/ChangingFilePermissions

http://www.tipsandtricks-hq.com/how-to- … press-5264">http://www.tipsandtricks-hq.com/how-to-fix-the-unable-to-create-directory-error-in-wordpress-5264

How might I "reset" my WP install to start over or fix this? super frustrating to not be able to manage files and permissions properly. Can anyone frame where I am with this stuff and what I need to understand better? Thanks!

8 Replies

If you get that error that means you're giving an incorrect path. What commands are you trying to run?

You need to figure out what user PHP runs as. Then, make sure that user is allowed to write to the uploads/* directory.

My guess is that your uploads directory isn't owned by Apache. In Terminal, CD to your wp-content directory and type this command:

chown -R www-data:www-data uploads

That should fix it.

@nicholasmark:

My guess is that your uploads directory isn't owned by Apache. In Terminal, CD to your wp-content directory and type this command:

chown -R www-data:www-data uploads

That should fix it.

Thanks for your reply. I think this is how I CD to my wp-content, but as a newbie I wasn't sure..

cd Public/wp-content/themes/base

gets me

No such file or directory

i must be missing something. Maybe my uploads directory is not properly created or configured?

@Nuvini:

If you get that error that means you're giving an incorrect path. What commands are you trying to run?

You need to figure out what user PHP runs as. Then, make sure that user is allowed to write to the uploads/* directory.

thanks for your help. I guess I'm not sure that I have successfully created an uploads directory. I assumed that I did because I have posted on my wordpress site (which I believe I am hosting on the VPS) but it was only text that has been successfully posted. would WP even work if I did not have an uploads directory?

a moderator at WP forums suggested the following in helping me allow file permissions by searching out the directory:

"Your theme resides in wp-content/themes if that directory wasn't there your site would not load. To get list of all directories under your current location:

find . -type d

to find the path to wp-content:

find . -name wp-content -type d

If it is not there then change directory to your root dir.

cd ~

Also just to note if you installed WordPress via the Ubuntu package manager (apt-get install wordpress) you will consistently have problems and I would recommend starting over."

Following the above advice, I'm still not even able to find the proper directory which stores my wp-content. This might be part of the problem in allowing file permissions. It is strange because my site is up with the fourteen theme and one blog post. Any ideas as to how to move forward? I installed wordpress with wget command in the linode WP guide. The only directories I find are:

./public

./public/exampledesign.info

./public/exampledesign.info/public

./public/exampledesign.info/log

./public/exampledesign.info/backup

./.cache

Are you logging in as root in Terminal? If so it sounds like you need to change directory (out of the 'root' directory) before running the find command. Type:

CD .. (CD followed by a space and two dots)

Then the find command:

find . -name wp-content -type d

This should show you the location of wp-content (although below you seem unsure that you've installed WordPress on your Linode: "(which I believe I am hosting on the VPS)"). If it does show you the location of wp-content, CD to wp-content and create an uploads folder (if one doesn't already exist) with the following command:

mkdir uploads

Then run the command I recommended above (run this even if the uploads folder already exists):

chown -R www-data:www-data uploads

If that doesn't do it, I recommend you get someone who knows a little more about basic Linux server management to do it for you, because you seem a little out of your depth.

@nicholasmark:

Are you logging in as root in Terminal? If so it sounds like you need to change directory (out of the 'root' directory) before running the find command. Type:

CD .. (CD followed by a space and two dots)

Then the find command:

find . -name wp-content -type d

This should show you the location of wp-content (although below you seem unsure that you've installed WordPress on your Linode: "(which I believe I am hosting on the VPS)"). If it does show you the location of wp-content, CD to wp-content and create an uploads folder (if one doesn't already exist) with the following command:

mkdir uploads

Then run the command I recommended above (run this even if the uploads folder already exists):

chown -R www-data:www-data uploads

If that doesn't do it, I recommend you get someone who knows a little more about basic Linux server management to do it for you, because you seem a little out of your depth.

Thanks! using the following command really helped:

cd ..

and then I followed your other instructions. i added sudo somewhere though because it said permission denied at some point in the process. but i can now upload images without file permissions error. now i guess the next step is to start reading basic linux server management. :mrgreen:

Good to hear.

I didn't mean to be rude re my server management comment, it's just that hosting WordPress sites these days can be a risky business if you don't know what you're doing. Bots/individuals try to brute force password attack WordPress sites on my Linode constantly (I limit access to the login page - wp-login.php - by IP address to prevent such attacks). One WordPress site on my Linode recently had over 14,000 attempts to access wp-login.php in 24 hours. There's lots you can do to minimise the risk (some good advice here: http://codex.wordpress.org/Hardening_WordPress) but most of all make sure you have a good backup plan in place.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct