I need to deploy my app to server called
lovelyplace by a Fabric script. Unfortunately, the server's setup is horrible, but I can do nothing about it - I have to live with it.
There is one non-root user I can use for ordinary stuff, let's name her
alice. Then there is another user, let's name him
bob has root privilegies. The admin who prepared the server installed all stuff to places where one can operate only as root, so
bob is needed for practically everything I do.
I have a password only for
alice's account. I have no password for
bob, but I was told I can use his powers by typing
sudo su - bob and then doing stuff. And that's true - in a shell I can do this (with no password prompts!) and then I am logged in as
bob and I can do anything. However, I need to do this non-interactively, in a script. Something like
sudo su - bob && whoami.
But I could not come up with any other way to gain
sudo su -c whoami bob results in
[sudo] password for alice: and then
Sorry, user alice is not allowed to execute '/bin/bash' as bob on lovelyplace.
I tried many combinations of
sudo, etc., but the result is always the same - password prompt and after that, rejection.
I need to come up with the way to programmaticaly log in to the server as
alice and then execute stuff as
bob. I need a non-interactive one liner similar to
sudo whoami, which would print out
bob. Otherwise I am not able to deploy my app by script.
Any suggestions how to mimic this strange
sudo su - bob in script?
bob does not have the same powers as root. He can't read sudoers, etc., so he has more privileges than
alice, but apparently not that much to adjust root settings.