Linux用户管理操作杂谈

1、设置账户相关信息

ubuntu@ubuntu:~$ chfn
Password: 
Changing the user information for ubuntu
Enter the new value, or press ENTER for the default
        Full Name: ubuntu
        Room Number []: 53D@tanglan
        Work Phone []: null
        Home Phone []: 1866595****
2、查看账户相关信息

ubuntu@ubuntu:~$ finger ubuntu
Login: ubuntu                           Name: ubuntu
Directory: /home/ubuntu                 Shell: /bin/bash
Office: 53D@tanglan, null               Home Phone: 1866595****
On since Mon Nov 25 08:57 (CST) on tty7 from :0
    1 day 1 hour idle
On since Tue Nov 26 08:56 (CST) on pts/0 from 192.168.1.45 (messages off)
No mail.
No Plan.
3、添加用户user1、user2、user3,用户组group_test,将user1划定为组管理员,测试添加组员权限

root@ubuntu:~# groupadd group_test//建立群组group_test
root@ubuntu:~# gpasswd group_test
Changing the password for group group_test
New Password: 
Re-enter new password: 
root@ubuntu:~# useradd user1
root@ubuntu:~# useradd user2
root@ubuntu:~# gpasswd -A user1 group_test//设定user1为组管理员
root@ubuntu:/home/ubuntu# passwd user1
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@ubuntu:/home/ubuntu# exit
exit
ubuntu@ubuntu:~$ su user1
Password: 
$ id 
uid=1001(user1) gid=1003(user1) groups=1003(user1)
$ gpasswd -a user1 group_test
Adding user user1 to group group_test
$ gpasswd -a user2 group_test
Adding user user2 to group group_test
$ su root -l
Password: 
root@ubuntu:~# useradd user3
root@ubuntu:~# passwd user3
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@ubuntu:~# passwd user2
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@ubuntu:~# su user2//测试其他账户对组的管理权限
$ gpasswd -a user3 group_test
gpasswd: Permission denied.//操作被拒绝

4、/etc/shadow 和/etc/passwd 字段解析

root:x:0:0:root:/root:/bin/bash
<1>帐号名称
<2>密码
<3>UID:0=系统管理员;1-499=系统帐号;500-65535可登入帐号
<4>GID
<5>用户信息栏
<6>家目录
<7>shell
root:$6$F/:16029:0:99999:7:::
<1>帐号名称
<2>密码
<3>最近更动密码的日期(1970-1-1)
<4>密码不可更动的天数
<5>密码需要更新变更的天数
<6>密码需要变更期限前的警告天数
<7>密码过期后的帐号宽限时间(密码失效日)
<8>帐号失效日期
<9>保留











  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值