最近在用云服务器的时候发现一个问题,不管当我用密码还是key的方式ssh到云服务器的时候。
敲sudo -i
不需要密码都可以切换到root
!刚登陆就敲的,之前没有sudo过。
怎么会有这么bug的命令啊!
是那个地方的设置问题么?
而且我的问题不好搜索,带上-
这种字符都过滤掉了。
/etc/sudoers
如下:
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin 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
假设你的系统是centos,从你的描述来看,说明你执行sudo -i的用户已经配置过无密码sudo到root用户的权限。
可以新建一个普通用户来测试下,假设你的系统中现在没有test这个用户,用root用户执行以下命令行测试: