3

I wanted to use WP-CLI commands in my putty WordPress 5.5.1 & Ubuntu 20.04 Droplet but “When I use Wp commands without –allow-root then It shows an error that you are accessing as the root user,” and I know it’s un-secure to use –allow-root. Please Can anyone help me in accessing wp commands in my Putty without –allow-root.

4
  • Is root the only user on your droplet? You could (and probably should) create a less-powerful user, give it write access to your website, and then su {username} and use wp as that user instead.
    – Pat J
    Oct 17, 2020 at 18:43
  • I tried it and I create a user with "su adduser" and I know username & password but how can I access it, can log in in my ssh as I log in with root user, or I need to run some command to switch between user.
    – Sachin
    Oct 17, 2020 at 19:09
  • If you're logged in as root, you should be able to do su {username} where {username} is the username you set up. If you're root, it shouldn't ask you for a password.
    – Pat J
    Oct 17, 2020 at 20:33
  • 1
    Thank you brother, It worked and now, I can use Wp-Cli commands
    – Sachin
    Oct 18, 2020 at 3:50

1 Answer 1

3

You can do is to create an additional user and switch to it in order to use the wp-cli

2
  • Yeh! It worked...
    – Sachin
    Oct 18, 2020 at 3:49
  • Please upvote my answer and mark it as solution :) so users can benifit Oct 18, 2020 at 13:01

Your Answer

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

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