Rootop 服务器运维与web架构

centos修改密码提示 authentication token manipulation error

在centos单用户模式下修改root密码提示错误:
authentication token manipulation error

分析是修改密码时要去修改/etc/shadow文件,但是此文件可能出现问题,不能被修改,查看特殊权限(lsattr)里面被添加了一个a位
a位代表append only,只能追加数据,不能修改数据,所以修改密码时报错。

测试a位作用:

root@rootop:~# touch a
root@rootop:~# chattr +a a
root@rootop:~# lsattr a
-----a--------e--- a
root@rootop:~# echo a > a
-bash: a: Operation not permitted
# 提示操作不允许
root@rootop:~# echo a >> a
root@rootop:~# cat a
a
# 追加数据可以

上面a文件的e位在man文档中解释:
extent format (e)
The ‘e’ attribute indicates that the file is using extents for mapping the blocks on disk. It may not be removed using chattr(1).
“e”属性位表示文件正在使用区段映射磁盘上的块。不能使用chattr删除此位。

所以上面的问题,通过chattr去掉a位权限即可。
为什么会多出来个a位权限?
排查是服务器被黑了。

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/4636.html

作者:Venus

服务器运维与性能优化

评论已关闭。