cd 
vi .bashrc 
# 在最后添加
alias shutdown='echo '\''Please contact the root'\'''
alias reboot='echo '\''Please contact the root'\'''
alias init='echo '\''Please contact the root'\'''
alias halt='echo '\''Please contact the root'\'''
alias poweroff='echo '\''Please contact the root'\'''

禁止root用户无意使用关机命令

效果如下

禁止root用户无意使用关机命令

相关文章: