一.创建用户
1.创建新用户: useradd 用户名
id 用户名 (查看用户信息)
[root@VM_0_5_centos ~]# useradd redwine
[root@VM_0_5_centos ~]# id redwine
uid=1003(redwine) gid=1004(redwine) groups=1004(redwine)
2.创建用户的同时加入组 useradd -g 组名 用户名
[root@VM_0_5_centos home]# useradd -g root redwine
[root@VM_0_5_centos home]# id redwine
uid=1003(redwine) gid=0(root) groups=0(root)
3.修改用户密码: passwd 用户名
[root@VM_0_5_centos home]# passwd redwine
Changing password for user redwine.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
切换用户:
[wenhongjun@VM_0_5_centos home]$ su redwine
Password:
[redwine@VM_0_5_centos home]$
4.删除用户: userdel 用户名
[root@VM_0_5_centos ~]# userdel -r redwine
[root@VM_0_5_centos ~]# id redwine
id: redwine: no such user
5.查看系统中的所有用户或者用户组
cat /etc/passwd
c


274

被折叠的 条评论
为什么被折叠?



