we have a private network that we connect to using openconnect, then we run ssh to the server we want to work
I have a file named ssh.sh:
#!/usr/bin/expect -f
set timeout -1
spawn ssh -L 3306:localhost:3306 -L 8600:localhost:8600 -L 5672:localhost:5672 -L 5000:localhost:5000 myusername@xx.xxx.xxx.xxx
expect "myusername@xx.xxx.xxx.xxx's password:"
send -- "mypass\r"
expect eof
when I call it by ./ssh.sh
command, it works. but when I call this script in another one by ./ssh.sh
command, it says:
spawn ssh -L 3306:localhost:3306 -L 8600:localhost:8600 -L 5672:localhost:5672 -L 5000:localhost:5000 myusername@xx.xxx.xxx.xxx
The authenticity of host 'xx.xxx.xxx.xxx (xx.xxx.xxx.xxx)' can't be established.
ED25519 key fingerprint is SHA256:AkfGt+ZPLk5EnMl+QR4Lg1bJZwolgk%KTf1o4iFoP3E.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?
UPDATE: it works correctly when I just call ./ssh.sh, but not when called as subshell
even if I say yes to that message, it still doesn't connect