I have set-up my first VPS (Ubuntu). Apache 2 and php were pre-installed, I was able to install wp-cli, but it is kinda useless for me know. I am getting user permissions error. For example when I run

wp core download

I am getting an error

Error: /var/www/example.com/public_html/ is not writable by current user

I am using user which is member of root group and I have also tried to add user into a www-data group. The folder public_html is own by www-data:www-data (default Apache settings).

I know that this might be more Ubuntu than Wordpress issue, but I though this is still better place to ask the question than AskUbuntu.com. If I am wrong, I don't mind moving this question.


2 Answers 2


I think the error is very clear. The owner of public_html is www-data, you don't have any permisson to write to that folder.

You can use whatever user you want as long as that user have permission to read, write and execute your DOCUMENT_ROOT folder. But you shouldn't use root user.

So, to solve that error, try:

sudo chown -R `whoami`:www-data /var/www/example.com/public_html

That's all ;-)


If the file owner is allowed to run a shell I find that su-ing to that user works fine. I'm running suPHP so each site has its own user which can login. I don't know if the default Apache user is more restricted.

I wouldn't follow the advice to chown the files as your web server might then choke.

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