root@test:~# cat /etc/sudoers
#
# 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:/snap/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# 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
test ALL=(ALL:ALL) NOPASSWD:ALL #添加这行代码
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
ubuntu 其他用户切换到root免密
于 2023-04-10 13:23:51 首次发布
该文件定义了sudoers的规则,包括默认设置如环境重置和安全路径。主要内容涉及root用户的全权限,admin组和sudo组的成员权限,以及在/etc/sudoers.d/目录下包含额外配置。新增了允许test用户无密码执行所有命令的规则。
摘要由CSDN通过智能技术生成