Hello,
I'm trying to learn and automate some tasks via a script, but my first ever script failed with "connection closed by foreign host" error. I checked the other discussions but it didn't help. Could you please help?
#!/bin/bash
( sleep 2
echo open x.x.x.x 23
sleep 2
echo user
sleep 2
echo pass
sleep 2
) | telnet
The following options work without script;
- # telnet x.x.x.x
- # telnet
> open x.x.x.x
The script also works for other in-band connection IPs, which directly request user and password without viewing any system info.
We connect this node over auxiliary port via a modem. On putty x.x.x.x 23 connects to our device and x.x.x.x 22 to our server. I got some wireshark captures; the TELNET session continues negotiation, and suddenly interrupts.