Security – How to give user root access without giving him root password

accountspermissionsrootSecurity

The scenario is this:

  • I have a development machine I want (need) to have root access to
  • Our admin setups the machines using his own credentials for the root user. The explanation being that if something goes wrong or he needs to change something he just have to remember one password
  • He then proceeds to give each user access to "sudo" without questioning for the password

Now I really dislike the fact that sudo wouldn't prompt me for my password. How does a user configuration look like that gives me and the admin complete root permissions (2 logins), with sudo prompting me for my password (and not root) look like?

Best Answer

Type visudo, you will see something like this:

<your_user>  ALL=(ALL)   NOPASSWD:ALL

If you want sudo prompt for a password, just remove NOPASSWD

<your_user>  ALL=(ALL)   ALL

UPDATE

As @MikeyB mentioned, by default, sudo will prompt for a password of the invoking user. But if you turn on the targetpw flag:

Defaults targetpw

sudo will ask for the password of the target user.