I have an Ubuntu server, typical LAMP stack with default www-data as the user / group under which Apache serves files.

When updating with WP-CLI I always have to type --allow-root flag.

How do I avoid this?

If I do what the software suggests then sudo -u www-data -i -- wp <command> throws an error: "This account is currently not available."

5 Answers 5


All files and folders should be owned by www-data user and group if not then WordPress can't change files hence fails to update from dashboard. wp-cli says to use sudo -u www-data -i -- wp <command> but that gives This account is currently not available.

Why? See this answer: https://askubuntu.com/a/486661/695240

You're getting the This account is currently not available. error because the shell for the user www-data is set to /usr/sbin/nologin, and it's set for a very good reason. You should not log in as www-data, it's a special user/group used by the web server, not intended for regular shell use.

EDIT: It is an especially bad idea to give sudo rights to www-data. If Apache was intended to run with root permissions, it wouldn't have it's own group. By doing this, you are creating huge security holes. You have been warned.

What is the solution? Use sudo -u www-data wp<command>. So you don't have problem using wp-cli and is safe. All files create by wp-cli will be owned by www-data.


first of all you need to fix so you're allowed to login as www-data if that's what you want to do. Otherwise you can do this as root. If you're logged in as root, add to your shell (i.e. /root/.bash_aliases)

alias wp='wp --allow-root'

That's all.


I got the recommendation to use www-data too at first, but in another thread people were recommending against using the www-data user, because it's a special user that shouldn't be used for this purpose.

So then I figured out how to add a new user to SSH via a Digital Ocean tutorial. Run adduser exampleusername and then you can run su - exampleusername to switch to that user. Now wp will run without giving the root user error message.

It's baffling that I couldn't find that written down anywhere. The WP docs and most of the conversation about this assume that everybody already knows their way around a server.


You will need login into the user you will use for wordpress, I think the default user will admin, then you will need login in SSH with:

ssh admin@put-your-ip Add password

Then you can go now

  • How does it help the OP? Why would be the default username admin?
    – bravokeyl
    Commented Aug 23, 2016 at 18:35
  • The default user admin just for example, you need use correct username will install the wordpress site. Commented Aug 23, 2016 at 18:38

If you are logged in as root, just become another user with the following command:

su [username]

Replace [username] with something like admin, or a user you know has privileges to run wp cli commands. (admin should be there in many cases).

When done, exit out of that user operation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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