centos新增普通使用者
阿新 • • 發佈:2018-11-19
centos新增普通使用者流程
新增普通使用者
[[email protected] ~]# adduser dadi
密碼
[[email protected] ~]# passwd dadi
密碼設定過於簡單的話會有提示
先檢視許可權
[[email protected] ~]# ls -l /etc/sudoers
-r--r----- 1 root root 4002 Mar 1 2012 /etc/sudoers
修改許可權,增加寫許可權
[[email protected] ~]# chmod -v u+w /etc/sudoers mode of `/etc/sudoers' changed to 0640 (rw-r-----)
新增新使用者
[[email protected] ~]# vim /etc/sudoers
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
dadi ALL=(ALL) ALL #This is a new user
## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
儲存修改的檔案,ESC 退出編輯模式,:wq儲存
通過cat /etc/sudoers,可以檢視修改後的檔案內容
[[email protected] ~]# cat /etc/sudoers
將許可權再修改回來
[[email protected] ~]# chmod -v u-w /etc/sudoers
mode of `/etc/sudoers' changed to 0440 (r--r-----)
普通使用者建立完畢,可以進行使用者切換
[[email protected] ~]# su dadi