$linuxcli.in _    [commands]    [tips & tricks]    [manpage]    [ESXi CLi]    [what is my ip?]    [pingme!]    [BIOS lock code]    [Code repo]


Run sudo without entering password


The sudo command mostly use in a environment to have super user's privilege but with some restrictions. There is a logging feature which record every activity done with sudo command.

The /etc/sudoers file is a configuration file of sudo to restrict use of super user's privilege.

In sudo command to be root user or to run any command with root user's privilege it ask for current user's password while by adding below line after running visudo command it will not ask password and it will authorise as a root.

User must re-login to use this configuration of sudo.

In sudo configuration file, group are represent with percentage (%) sign before it's name. Like in below line wheel is a group and in this option it is added as %wheel. If % sign is not mention before group name then that will known as user in sudo configuration file.

The NOPASSWD option is use in sudo for to not ask password.

%wheel ALL = NOPASSWD:ALL

Similarly instead of user we can give full root privilege to a script and only that script will have root pemission instead of user.

%wheel ALL = NOPASSWD:/usr/bin/scriptFile

Last updated on 30 June 2023 10:43 am IST