如果shadow文件中有“!!”如何修改密码?

如果shadow文件中有“!!”如何修改密码?
[root@notebook ~]# grep USER /etc/shadow
USER:!!:16577:1:90:7:::
[root@notebook ~]# 
[root@notebook ~]# su - USER
[USER@notebook ~]$ id
uid=1000(USER) gid=983(GROUPN) groups=983(GROUPN),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[USER@notebook ~]$ passwd
Changing password for user USER.
Changing password for USER.
(current) UNIX password: 
passwd: Authentication token manipulation error
[USER@notebook ~]$ 

问题:我是 RHEL 机器上的普通用户。没有root权限如何修改密码?

当它在密码更改时询问当前密码时,我只需按 Enter,因为没有设置密码,请参阅“!!”。

答案1

您不能,至少您必须具有 sudo 访问权限或 USER 必须具有 sudo 权限。

答案2

本例中的问题是,没有有效的密码可指定为现有密码。该passwd命令允许 root 更改其他用户的密码,而无需输入原始密码。您可以修改 sudoers(当然是 root)以允许该用户更改该用户的密码:

USER ALL = (root) NOPASSWD: /usr/bin/passwd USER

这种方法至少有一个弱点:用户可以忽略系统针对糟糕、愚蠢的密码的保护措施。

相关内容