On Thursday, 14 July 2022 23:22:46 CEST Steve Wilson wrote: > 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
> 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. > This looks promising. Will have a look to see if this can be made to work. I will need to find a way to get the password programmatically inside the script as I will not put it on the commandline and definitely not hard-coded in a script. -- Joost

