Linux中分兩個基本用戶, ROOT(系統管理員)和 user(普通用戶)
root 用戶系統自帶
user普通需要自己添加
1.首先查看當前狀態用戶 whomai
[root@2018sh001 ~]# whoami
root
2.創建新普通用戶 useradd test
id test 檢查剛剛創建的用戶名是否存在
[root@2018sh001 ~]# useradd test
[root@2018sh001 ~]# id test
uid=1002(test) gid=1002(test) groups=1002(test)
3. 給新創建的用戶設置密碼 passwd test
[root@2018sh001 ~]# passwd test
Changing password for user test.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
4. 切換到新用戶 su - test
[root@2018sh001 ~]# su - test
Last failed login: Wed Jan 30 10:46:08 CST 2019 from 89.7.28.6 on ssh:notty
There were 1502 failed login attempts since the last successful login.
[test@2018sh001 ~]$ whoami
test
5.退出普通用戶推薦使用 快捷鍵 ctrl+d
su - root 切換到管理員需要密碼驗證 ,所以不推薦使用
