Home > Article > System Tutorial > No password required to run sudo commands in Linux
Assuming you are running a Linux system on a computer that you only use, such as a laptop, you will need to enter a password every time you call sudo, which will be tedious in the long run. Therefore, in this guide, we will describe how to configure the sudo command to run without entering a password.
This setting is done in the /etc/sudoers file, which is the default security policy using the sudo command; in the user permissions specification section.
IMPORTANT: In sudeors files, the authenticate parameter is turned on by default for authentication purposes. If it is set, the user must authenticate with a password (or other authentication method) before they can run a command using sudo.
However, this default can be overridden using the NOPASSWD (no password required when user calls sudo command) flag.
The syntax for configuring user permissions is as follows:user_list host_list=effective_user_list tag_list command_list
in:
To allow a user (aaronkilik in the example below) to run all commands using sudo without entering a password, open the sudoers file:
$ sudo visudoAdd the following lines:
aaronkilik ALL=(ALL) NOPASSWD: ALL
For groups, use the % characters before the group name; this means that all members of the sys group can use sudo without a password.
%sys ALL=(ALL) NOPASSWD: ALL
To allow users to run the specified command without a password using sudo (/bin/kill), add the following line:
aaronkilik ALL=(ALL) NOPASSWD: /bin/kill
下面的行会让 sys 组成员在使用 sudo 运行命令:/bin/kill 、/bin/rm 时不用输入密码:
%sys ALL=(ALL) NOPASSWD: /bin/kill, /bin/rm
不用密码运行 sudo
在本篇中,我们讨论了如何配置 sudo 命令来不用输入密码运行。不要忘记在评论栏中给我们提供你关于这份指导的想法和其他对于 Linux 系统管理员有用的 sudoers 配置。
The above is the detailed content of No password required to run sudo commands in Linux. For more information, please follow other related articles on the PHP Chinese website!