I’m currently facing a weird problem while executing a command from my bash script.
My script has this command,
ssh IPAddressA -l root "ssh -l root IPAddressB ls"
where IPAddressA & IPAddressB would be replaced by hard coded IP addresses of two machines accessible from each other.
The user would enter the password whenever asked. But, I’m getting this error after I enter the IPAddressA’s password.
root@IPAddressA's password:
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
]$
When the inner ssh password is prompted, there’s no interactive keyboard available. You can get what you want with ssh tunneling.
The first line open a tunnel, so your localhost
2222port points toIPAddressB:22andd bring the ssh process in background (-f) without executing a command (-N)The second line connects
IPAddressB:22through the new opened tunnel