|
建立两个用户aaa和bbb,并建立同名群组:
useradd -U aaa
useradd -U bbb
--------
Problem 1:
查看/etc/passwd发现
aaa:x:1001:1001::/home/aaa:/bin/bash
也就是用户aaa的初始群组是同名群组aaa。
查看/etc/group发现
aaa:x:1001:
也就是虽然群组aaa已经建立,但是并没有加入用户aaa,这个是为什么?useradd的-U选项不是说:
Create a group with the same name as the user, and add the user to this group.
(bbb也是类似的结果)
--------
清空群组bbb的群组密码:
gpasswd -r bbb
查看/etc/group发现
bbb::1002:
查看/etc/gshadow发现
bbb:::
设置群组bbb的群组密码为123456:
gpasswd bbb
然后输入123456
查看/etc/group发现
bbb::1002:
查看/etc/gshadow发现
bbb:[123456的加密字串]::
然后转到用户aaa
su aaa
newgrp bbb
输入123456之后,提示Invalid password
后来发现先用
grpunconv
把密码从/etc/gshadow搞到/etc/group后,再
su aaa
newgrp bbb
输入123456之后,就可以了
可是man newgrp里写着:
If there is an entry for this group in /etc/gshadow, then the list of members and the password of this group will be taken from this file, otherwise, the entry in /etc/group is considered.
难道说newgrp不认/etc/gshadow么,还是哪里配置有问题? |
|