admin管理员组文章数量:1122846
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.
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.
Share Improve this question edited Oct 17, 2020 at 20:51 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Oct 17, 2020 at 18:31 SachinSachin 411 silver badge4 bronze badges 5 |2 Answers
Reset to default 3You can do is to create an additional user and switch to it in order to use the wp-cli
If you're logged in as root
or sudo
and want an easy way to use the wp
commands without having to manually switch to another user (etc) you can create a shell function.
See Tom's answer here: https://wordpress.stackexchange.com/a/424419/152624
function noroot() {
sudo -EH -u "webuser" "$@";
}
noroot wp post list # <- runs as webuser not root
Or, just make an alias for wp
in your .bashrc
or such so that wp
actually means:
alias wp='sudo -u [non-root-user-here] wp'
本文标签: wp queryHow can I use WPCLI commands without allowroot
版权声明:本文标题:wp query - How can I use WP-CLI commands without --allow-root 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736311412a1934729.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
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 thensu {username}
and usewp
as that user instead. – Pat J Commented Oct 17, 2020 at 18:43root
, you should be able to dosu {username}
where{username}
is the username you set up. If you're root, it shouldn't ask you for a password. – Pat J Commented Oct 17, 2020 at 20:33