Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I'm new to Ubuntu and Wordpress. when I'm trying to upload image in Wordpress its says

Unable to create directory localhost/2014/01. 
Is its parent directory writable by the server?
share|improve this question

closed as unclear what you're asking by Braiam, guntbert, Eric Carvalho, ImaginaryRobots, mikewhatever Jan 28 '14 at 20:26

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Is Wordpress running on Ubuntu? –  guntbert Jan 27 '14 at 21:18

3 Answers 3

This should be a access permission problem. Open a terminal (ctrl + shift + t) and go to your installation directory. Enter ls -al (or ll) and you can see the permissions set for users, groups and others (checkout https://en.wikipedia.org/wiki/Chmod for more info). You must make sure that the user of your webserver (e.g. www-data for Apache) has rights to write to the wp-content/ directory.

You can also checkout the WP Wiki for more information on access rights. The solution to this problem can be done either by setting write permissions to others:

chmod -r o+rwx /path/to/uploads/ 

or even better by changing the owner/group of the directory to your webserver:

chown -R www-data:YOURUSERNAME

and give respective rights as mentioned above.

If the directory doesn't exist you can just create it (default path is /var/www/wp-content/uploads):

sudo mkdir /var/www/wp-content/uploads

Now you can set the permissions:

sudo chown -R www-data:root

Note: you could also drop -R parameter (it stands for recursive) since there are no subdirectories at the moment. Additionally if the WP is installed in aforementioned default path you can leave the group owner (root) intact.

share|improve this answer
after doing ls -al in terminal. there is no name like www-data –  vikas Jan 26 '14 at 11:47
Are you using apache as webserver? I suggest that you read the WP Wiki and man pages for chmod. I will add a short summary of to be done in the answer. –  Yan Zax Jan 26 '14 at 11:57
yes m using apache. can u tell me exact terminal command for giving read write access to www-data? yes m reading wiki pages that u ve linked. –  vikas Jan 26 '14 at 12:00
Giving rights is done with chmod and changing owner with chown use man chmod and man chown to see manual pages and examples. –  Yan Zax Jan 26 '14 at 12:02
i dont know where wordpress uploads file, there is nothing like www-data in /var. it only says Unable to create directory localhost/2014/01. Is its parent directory writable by the server? i have downloaded wordpress in home folder and copied it to /var/www. should i copy wordpress to another folder or what. how to know where wordpress uploads file(media)? –  vikas Jan 26 '14 at 16:05

According to your comments, WordPress is trying to create the uploads directory but it isn't being allowed access.

Since your installation is in /var/www, you will need to run the following commands:

  1. Manually create the uploads directory

    sudo mkidr /var/www/wordpress/wp-content/uploads
  2. Give ownership to Apache on the uploads directory

    sudo chown www-data /var/www/wordpress/wp-content/uploads

To make sure the directory is created with correct permissions, running the following command:

ls -l /var/www/wordpress/wp-content/uploads

should give a similar output

drwxr-xr-x 3 www-data root 4096 Nov 13 10:36 ./
drwxr-xr-x 6 root     root 4096 Nov 18 12:34 ../

Notice the drwxr-xr-x 3 www-data root permissions on the ./ directory in the first line in the output

share|improve this answer

http://www.wordpress.org/support/topic/folder-permission-on-linux-ubuntu?replies=18 this solves my problem now i can upload images in wordpress

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.