sudo -l
给我输出:
User test may run the following commands on server:
(root) NOPASSWD: /usr/bin/vim /usr/bin/motd
sudo -ll
给我输出:
Sudoers entry:
RunAsUsers: root
Options: !authenticate
Commands:
/usr/bin/vim /usr/bin/motd
当我以用户“测试”身份运行时,sudo /usr/bin/vim
出现错误:
Sorry, user test is not allowed to run '/usr/bin/vim' as root on server.
我觉得这是由于 usr/bin/vim 符号链接到另一个文件/usr/bin/vim -> /etc/alternatives/vim
我能做什么吗?
答案1
事实证明我误解了sudo -l
命令。此消息:
User test may run the following commands on server:
(root) NOPASSWD: /usr/bin/vim /usr/bin/motd
意味着唯一不需要密码就可以运行的命令vim
是/usr/bin/motd
争论。这并不意味着vim
或者motd
可以自由运行。
我感觉自己像个白痴:D