用户和用户组的基本管理命令

一 实战
[root@localhost ~]# groupadd sexy
[root@localhost ~]# groupmod -n market sexy
[root@localhost ~]# groupmod -g 668 market
[root@localhost ~]# groupadd -g 888 boss
[root@localhost ~]# groupdel market
[root@localhost ~]# groupadd sexy
[root@localhost ~]# useradd -g sexy sdf
[root@localhost ~]# useradd -g sexy jzmb
[root@localhost ~]# useradd -d /home/xxx test
[root@localhost ~]# cat /etc/passwd
[root@localhost ~]# usermod -c dgdzmx sdf
[root@localhost ~]# usermod -l cls sdf
[root@localhost ~]# usermod -d /home/cls cls
[root@localhost ~]# usermod -g sexy test
[root@localhost ~]# userdel jzmb
[root@localhost ~]# touch /etc/nologin
[root@localhost ~]# passwd -ls cls
passwd: bad argument -ls: unknown option
[root@localhost ~]# passwd -l cls
Locking password for user cls.
passwd: Success
[root@localhost ~]# passwd -u cls
Unlocking password for user cls.
passwd: Warning: unlocked password would be empty.
passwd: Unsafe operation (use -f to force)
[root@localhost ~]# passwd -d cls
Removing password for user cls.
passwd: Success
 
二 主要组合附属组


 
 
三 实战
[root@localhost ~]# gpasswd -a cls boss
Adding user cls to group boss
[root@localhost ~]# newgrp boss
[root@localhost ~]# gpasswd -d cls boss
Removing user cls from group boss
[root@localhost ~]# useradd -g group1 -G group2
[root@localhost ~]# gpasswd test
Changing the password for group test
New Password:
Re-enter new password:
 
四 其他管理命令
[root@localhost ~]# su cakin24
[cakin24@localhost root]$ su root
Password:
[root@localhost ~]# whoami
root
[root@localhost ~]# id root
uid=0(root) gid=0(root) groups=0(root)
[root@localhost ~]# id cakin24
uid=1000(cakin24) gid=1000(cakin24) groups=1000(cakin24)
[root@localhost ~]# chfn cakin24
Changing finger information for cakin24.
Name [cakin24]: cakin24
Office []: cakin
Office Phone []: cakin
Home Phone []: cakin
 
Finger information changed.
 
  • 大小: 76.1 KB
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值