Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: file permissions
PostPosted: Sun Feb 09, 2014 3:12 pm 
Offline
Senior Newbie

Joined: Sun Feb 09, 2014 2:57 pm
Posts: 5
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/Changing_File_Permissions
http://www.tipsandtricks-hq.com/how-to- ... press-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!


Top
   
 Post subject: Re: file permissions
PostPosted: Sun Feb 09, 2014 5:01 pm 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
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.


Top
   
 Post subject: Re: file permissions
PostPosted: Mon Feb 10, 2014 5:57 am 
Offline
Junior Member

Joined: Fri Nov 01, 2013 8:16 am
Posts: 21
Website: http://purbeckpixels.com
Location: England
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.


Top
   
 Post subject: Re: file permissions
PostPosted: Tue Feb 11, 2014 1:16 pm 
Offline
Senior Newbie

Joined: Sun Feb 09, 2014 2:57 pm
Posts: 5
nicholasmark wrote:
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?


Last edited by linWPguy on Tue Feb 11, 2014 1:22 pm, edited 1 time in total.

Top
   
 Post subject: Re: file permissions
PostPosted: Tue Feb 11, 2014 1:22 pm 
Offline
Senior Newbie

Joined: Sun Feb 09, 2014 2:57 pm
Posts: 5
Nuvini wrote:
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?


Top
   
 Post subject: Re: file permissions
PostPosted: Wed Feb 12, 2014 2:58 pm 
Offline
Senior Newbie

Joined: Sun Feb 09, 2014 2:57 pm
Posts: 5
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


Top
   
 Post subject: Re: file permissions
PostPosted: Fri Feb 14, 2014 9:53 am 
Offline
Junior Member

Joined: Fri Nov 01, 2013 8:16 am
Posts: 21
Website: http://purbeckpixels.com
Location: England
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.


Top
   
 Post subject: Re: file permissions
PostPosted: Fri Feb 14, 2014 2:21 pm 
Offline
Senior Newbie

Joined: Sun Feb 09, 2014 2:57 pm
Posts: 5
nicholasmark wrote:
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:


Top
   
 Post subject: Re: file permissions
PostPosted: Fri Feb 14, 2014 7:27 pm 
Offline
Junior Member

Joined: Fri Nov 01, 2013 8:16 am
Posts: 21
Website: http://purbeckpixels.com
Location: England
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.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group