linux 添加用户 (centos7)


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    切换到管理员需要密码验证 ,所以不推荐使用

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM