I have a bash script running as
user, a user account with no evaluated privileges. The machine has a second account
admin which has sudo privileges. There is no root password set.
The script knows the account password for
admin. How do I escalate the script up to
sudo -S only handles the case of escalation using your current account's password, such as
user is unprivileged, so this won't work.
su admin works but provides no way to take a password from STDIN.
To rephrase, how can I achieve the below programmatically?
$ su admin Password: ****** $ sudo command Password: ******