1 |
Have you looked at dev-tcltk/expect? |
2 |
|
3 |
There's possibly an example you could try at |
4 |
<https://www.journaldev.com/1405/expect-script-ssh-example-tutorial> |
5 |
although you probably want to prompt for the password or retreive it |
6 |
programatically rather than putting it on the command line :o |
7 |
|
8 |
Steve. |
9 |
|
10 |
On 14/07/2022 07:35, J. Roeleveld wrote: |
11 |
> Hi All, |
12 |
> |
13 |
> I am looking for a way to login to a host and automatically change to root |
14 |
> using a password provided by an external program. |
15 |
> |
16 |
> The root passwords are stored in a vault and I can get passwords out using a |
17 |
> script after authenticating. |
18 |
> |
19 |
> Currently, I need to do a lot of the steps manually: |
20 |
> ssh <user>@<host> |
21 |
> su - |
22 |
> (copy/paste password from vault) |
23 |
> |
24 |
> I would like to change this to: |
25 |
> <some-script> <host> |
26 |
> |
27 |
> Does anyone have any hints on how to achieve this without adding a "NOPASSWD" |
28 |
> entry into /etc/sudoers ? |
29 |
> |
30 |
> Thanks in advance, |
31 |
> |
32 |
> Joost |
33 |
> |
34 |
> |
35 |
> |