passwd时报错passwd: Authentication token manipulation error

博客介绍了密码修改报错需考虑的两种情况。一是输入新密码后报错,可能是 /etc/passwd、/etc/shadow 文件被锁或磁盘、inode 满;二是输入 passwd 后立即报错,可能是 /etc/pam.d/ 认证处问题或 /etc/pam.d/system-auth 文件内容被清空,并给出相应解决办法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

出现这种问题需要考虑两种情况:
1、错误出现在输入完新密码后
网上的解决方法很多,大概如下:
问题:/etc/passwd, /etc/shadow文件被锁住,不允许修改。

[root@shanxi Desktop]# lsattr /etc/passwd 
----i-------- /etc/passwd
[root@shanxi Desktop]# lsattr /etc/shadow
----i-------- /etc/shadow

[root@shanxi Desktop]# passwd tom
Changing password for user tom.
New UNIX password: 
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password: 
passwd: Authentication token manipulation error

解决方法:

[root@shanxi Desktop]# chattr -i /etc/shadow 
[root@shanxi Desktop]# chattr -i /etc/passwd
[root@shanxi Desktop]# lsattr /etc/passwd
------------- /etc/passwd
[root@shanxi Desktop]# lsattr /etc/shadow 
------------- /etc/shadow

另外也有可能是磁盘满了,或者inode满了,通过df -h及df -i查看,当然我碰到的不是这种情况
2、输入完passwd后立即报错
应该是/etc/pam.d/认证的地方出问题了

[root@yitai02 ~]# passwd tom
Changing password for user tom .
passwd: Authentication token manipulation error
You have new mail in /var/spool/mail/root

看了一下是有一行被人注解掉了:

[root@yitai02 ~]# cat /etc/pam.d/passwd 
#%PAM-1.0
auth       required     pam_stack.so service=system-auth
account    required     pam_stack.so service=system-auth
#password   required    pam_stack.so service=system-auth

解决方法:

反注解

[root@yitai02 ~]# cat /etc/pam.d/passwd 
#%PAM-1.0
auth       required     pam_stack.so service=system-auth
account    required     pam_stack.so service=system-auth
password   required    pam_stack.so service=system-auth

另外也可以能是/etc/pam.d/system-auth 文件内容被人清空了。这种情况也不行。
可以都补上,如下:

[root@yitai02 ~]# cat /etc/pam.d/system-auth 
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      /lib/security/$ISA/pam_env.so
auth        sufficient    /lib/security/$ISA/pam_unix.so likeauth nullok
auth        required      /lib/security/$ISA/pam_deny.so

account     required      /lib/security/$ISA/pam_unix.so
account     sufficient    /lib/security/$ISA/pam_succeed_if.so uid < 100 quiet
account     required      /lib/security/$ISA/pam_permit.so

password    requisite     /lib/security/$ISA/pam_cracklib.so retry=3
password    sufficient    /lib/security/$ISA/pam_unix.so nullok use_authtok md5 shadow    ##我出现的问题是这一行被注释了,取消注释即可
password    required      /lib/security/$ISA/pam_deny.so

session     required      /lib/security/$ISA/pam_limits.so
session     required      /lib/security/$ISA/pam_unix.so

部分引用自:http://blog.51cto.com/7346473/1597137

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值