Centos7 創建用戶並賦予sudo權限


1.創建用戶

useradd test01

2.為用戶創建創建密碼

passwd test01

3.為普通用戶賦予sudo權限

① 使用root用戶登錄系統,首先修改文件/etc/sudoers的寫權限(默認為只讀,增加寫的權限)
  `chmod 640 /etc/sudoers`
② 使用vim編輯文件/etc/sudoers
  `vim /etc/sudoers`
③ 在root后面增加用戶名和ALL
  `## Allow root to run any commands anywhere
  root    ALL=(ALL)       ALL
  test01    ALL=(ALL)       ALL
  `
④ wq保存,並將/etc/sudoers改為只讀
 `chmod 440 /etc/sudoers`


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM