gpt4 book ai didi

linux - 在普通用户无法访问 etc/shadow 文件的情况下,passwd 命令如何允许他更改密码?

转载 作者:行者123 更新时间:2023-12-04 19:05:14 25 4
gpt4 key购买 nike

从技术上讲,一个无法访问 etc/shadow 文件的普通用户应该无法更改他的密码,因为他没有修改 etc/shadow 文件的权限。

最佳答案

“/usr/bin/passwd”文件归用户“root”所有,并设置了SETUID 位。该进程使用有效用户 ID 0(root)执行“/usr/bin/passwd”,因此可以更改“/etc/shadow”的内容。

$ ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 72424 Mar 3 19:41 /usr/bin/passwd
$ #^ That 's' means the file is executable and has the SETUID bit set.
$ # The mode of the file is 4755.

关于linux - 在普通用户无法访问 etc/shadow 文件的情况下,passwd 命令如何允许他更改密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71839786/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com