wordpress 命令行不运行使用root用户(sudo -u USER -i — wp )

作者

出于安全的原因,wordpress 命令行禁用了root用户的使用。如果当前是root用户在操作,需要使用sudo命令来切换账号,再执行命令。比较简介的方法是使用别名 alias

使用别名,可以少打一些字

alias wp='sudo -u YOU-USER -i wp --path=`pwd`'

Error: YIKES! It looks like you're running this as root. You probably meant to run this as the user that your WordPress installation exists under.

If you REALLY mean to run this as root, we won't stop you, but just bear in mind that any code on this site will then have full control of your server, making it quite DANGEROUS.

If you'd like to continue as root, please run this again, adding this flag: --allow-root

If you'd like to run it as the user that this site is under, you can run the following to become the respective user:

sudo -u USER -i -- wp <command>

回复

您的电子邮箱地址不会被公开。