Use Case:
1> ssh into a machine -->using the expect script automation
2> Once ssh'ed into the machine run a script from my local machine onto the remote machine
Currently I'm doing the following approach:
ssh admin@128.34.56.127 < ./s4.sh
Pseudo-terminal will not be allocated because stdin is not a terminal.
admin@13.126.76.184's password: <Provide password>
<Script executes without any errors>
In the above scenario, I have to provide my password manually which is not the intended use case for automation.
So will be using the expect option which should help automate the login procedure.
Sample Code:
#!/usr/bin/expect -f
spawn ssh admin@128.34.56.127
expect "password"
send "password\r"
This code helps automate the login, but in the expect code... how will I give the command to trigger another script from inside my current script?
expect
? Reason I am asking: Executing a script through SSH does not requireexpect
(there are easier ways to do this). If you still wish to useexpect
, the tags should be adjusted. – sborsky Oct 21 '17 at 16:47