Alice has sudo rights. Bob does not (this is not changeable), but does know the password to Alice's account.
If Bob wants to perform administrative commands he must:
su alice
- fill in Alice's password for su
sudo whoami
- fill in Alice's sudo password
- command gets executed with super user rights
To shorten this I use: su -m alice -c 'sudo whoami'
.
However, I want to build an alias command that replaces with this tedious command with just the regular sudo command.
So I made this: alias sudo="su -m alice -c 'sudo $@'"
.
2 caveats:
- It doesn't work
- It always asks for Alice's su password, the sudo password it does remember
How can I do this better?
Thanks!
This depends on the sudoers configuration. If "Defaults requiretty" is set this method wont work.
A few comments about this
Rik