centos新建用戶獲得root權限

1、useradd test 建用戶test
2、passwd test  修改密碼
3、vi /etc/sudoers 讓用戶具有root權限,修改這個文件,默認是隻讀的
4、如果不能修改讓文件能夠寫 chmod u+w /etc/sudoers
5、在文件裏了找到## Allow root to run any commands anywhere
加入如下內容:
## Allow root to run any commands anywhere 
root    ALL=(ALL)     ALL
test    ALL=(ALL)    ALL  #加入的內容,讓test具有root權限
6、按ESC退出鍵
7、輸入 wq 回車,保存修改
 
後續使用者加上sudo 命令  就可以具有root權限了,會提示輸入密碼   

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章