CentOS 7 建立一個可以執行sudo的帳號
如果,你需要建立一個擁有管理者權限的帳號給能幫忙管理伺服器的人使用,那你就可以參考此文章的作法囉!
(本範例以CentOS 7為例)
Step 1
建立帳號
1 |
[andy@www ~]$ useradd abc |
Step 2
設定密碼
1 |
[andy@www ~]$ passwd abc |
Step 3
修改設定檔
1 |
[andy@www ~]$ sudo visudo |
尋找設定值『ALL=(ALL)』
1 2 3 4 5 6 7 8 9 10 11 |
## Next comes the main part: which users can run what software on ## which machines (the sudoers file can be shared between multiple ## systems). ## Syntax: ## ## user MACHINE=COMMANDS ## ## The COMMANDS section may have other options added to it. ## ## Allow root to run any commands anywhere root ALL=(ALL) ALL |
在下一行新增設定值,abc就是想要改成能夠執行sudo的帳號
1 2 3 |
## Allow root to run any commands anywhere root ALL=(ALL) ALL abc ALL=(ALL) ALL |
Step 4
存檔離開
1 |
:wq |
大功告成!~