首先我们肯定知道是root用户下进行shutdown
一般我们就用su root然后输入密码
提示说shutdown不存在,我们去path里找(env查看信息),发现path里没有 /sbin
因为shutdown在/sbin中的,但是path里没有那么添加就可以了
其次在网上查找时,看到
su root 与su -root
分别以两种方式进入是 输入env
注意:USER 和 PATH 有不同,一看我们就知道了
图中你会发现你用su root时,没有/sbin(我的有 ,我加上了)
用su -root时,有/sbin
所有在su -root下 你可以shutdown
在su root下你不可以
现在你vi ~/.bashrc
增加了一条 export PATH=$PATH:/sbin
重启
之后发现,即使你使用su root也能shutdown了
转载于:https://blog.51cto.com/nobelking/1375585