Have you looked at dev-tcltk/expect?
There's possibly an example you could try at
<https://www.journaldev.com/1405/expect-script-ssh-example-tutorial>
although you probably want to prompt for the password or retreive it
programatically rather than putting it on the command line :o
Steve.
On 14/07/2022 07:35, J. Roeleveld wrote:
Hi All,
I am looking for a way to login to a host and automatically change to root
using a password provided by an external program.
The root passwords are stored in a vault and I can get passwords out using a
script after authenticating.
Currently, I need to do a lot of the steps manually:
ssh <user>@<host>
su -
(copy/paste password from vault)
I would like to change this to:
<some-script> <host>
Does anyone have any hints on how to achieve this without adding a "NOPASSWD"
entry into /etc/sudoers ?
Thanks in advance,
Joost