Linux中如何创建用户或用户组

一.创建用户
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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值