Ubuntu – How to make users gain root privileges from another account

12.10root

How can I make something like that:

There are two users: user with normal privileges, and administrator with admin privileges.

I want to make it like that:

user@localhost:~$ sudo vim 
[sudo] password for administrator: <admin's password here>

And I am on the administrator account now.

Best Answer

If you meant that when logged in as user you want to execute a command as administrator then you need to do:

user@localhost:~$ sudo -u administrator vim

However, the user's password will be asked not the one from adminitrator. To do so you need to run as administrator (hmm) the following command to configure sudo:

visudo

Then scroll down in the opened file and look for other Defaults definition. In this section, preferrably at the end of it, add a new line with:

Defaults targetpw

And save the file and exit. Note that this will change the default behaviour for all sudo users, so if your user administrator needs to use sudo to have root privilege, you would better know the root password!

Related Question