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!
man sudoedit
– Martin Schröder Feb 09 '13 at 12:13