Methods of payment Abuse

How to disable the password for the Sudo command

07.03.2021, 20:59

A utility called Sudo allows a regular user to operate the program with superuser rights. To prevent an outside user from accessing the program, the utility prompts for a password each time it runs. This is an important precaution, as it is important for the system to make sure that it is the user requesting access and not a program trying to harm the system. For various reasons, it may be necessary to disable the password. It's best not to do this, but if you really need to, the following instructions are for you.

The Sudo command in Linux without a password

To disable the Sudo password, all you need to do is add the NOPASSWD directive to the user or group configuration line.

This command is as follows:

username ALL=(ALL) NOPASSWD: ALL

Open the Sudo configuration file and disable the password for a particular user by making the following changes. Let's use the linux90 user as an example:

$ sudo visudo

linux90 ALL=(ALL) NOPASSWD: ALL

Next, save the changes made and close the file. For reference, vi uses the i key to enter insert mode, the :w command to save, and the :q command to exit. If done correctly as described above, sudo will not prompt the selected user for a password when executing any commands.

If you would like the user to be able to run only some commands without a password (apt and reboot) make this change:

linux90 ALL=(ALL) NOPASSWD: /usr/bin/apt, /sbin/reboot

To disable the password for a group of users use the following code:

%group_name ALL=(ALL) NOPASSWD: ALL

Save the changes and close the file. The linux90 user will now be able to execute usr/bin/apt, /sbin/reboot commands without a password, just like the users in the configured group.

Для того чтобы отключить пароль sudo для определенного пользователя нужно открыть файл конфигурации sudo и отключить запрос пароля следующей строчкой,