使用sudo lein run
时(因为该命令更改的某些文件需要priveleges),我收到此消息:
WARNING: You're currently running as root; probably by accident.
Press control-C to abort or Enter to continue as root.
Set LEIN_ROOT to disable this warning.
知道如何或在何处设置LEIN_ROOT以避免收到此消息?
答案 0 :(得分:3)
将LEIN_ROOT=true
添加到/etc/profile
的末尾。要使此更改生效,请在终端中输入source /etc/profile
。然后使用sudo -E lein run
运行命令以保留环境变量。
如果您通过ssh执行此操作,则需要在服务器上执行上述所有操作,然后将source /etc/profile
添加到本地计算机上运行的ssh命令的开头。
ssh user@123.456.789 "source /etc/profile; sudo -E lein run"