I am trying to use fabric to automate some administrative work that I am doing on a couple of servers. The general flow is the following:
- SSH with local user
- run:
sudo su -
to become root (providing local user password again) - Do the work as root :)
Unfortunately using run('sudo su -')
blocks execution of the scripts and allows user input. When I type exit
or Ctrl+D
the scipt resumes, but without root privileges.
I have seen a similar problem in Switching user in Fabric but I am restricted to sudo su -
because I am not allowed to change the /etc/sudoers
file which contains the following line:
localuser ALL = /usr/bin/su -
I browsed the source of fabric trying to find a workaround but with no success.