我搜索了很多但从未发现这种行为:
当我输入“sudo su”时,系统会要求我输入密码。但是当我输入密码时,系统会再次询问我。常规 3 次,作为主机用户 3 次。我什至可以输入 CTRL+d 6 次。总是有人再次问我,最后我是root。
myuser@myserver:~ $ sudo su
Password authentication
Password:
Password authentication
Password:
Password authentication
Password:
myuser@localhost's password:
Permission denied, please try again.
myuser@localhost's password:
Permission denied, please try again.
myuser@localhost's password:
myuser@localhost: Permission denied, please try again. (keyboard-interactive,password,publickkey).
root@myserver:/home/myuser# whoami
root
正如我所说,如果我在任何密码请求中输入正确的密码、错误的密码或 CTRL+D,它不会改变输出中的任何内容。
sudoers 的输入(用 visudo 编辑):
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
myuser ALL=(ALL:ALL) NOPASSWD:ALL
我是 sudo 组的成员:
cat /etc/group | grep sudo
sudo:x:27:myuser
它运行良好多年,我只能想象两种可能的事件(但由于我在这些事件之前或之后很长一段时间没有使用 sudo su,我什至不确定是否存在联系):
- apt-get 升级
- 可能是断电
你猜要检查什么吗?