Calling telnet from an ssh command

I am trying to figure out a problem, which I have to do in a certain way, unfortunately.

When I ssh into a remote host and log in (this will require a login), it is successful. If I then telnet to another host, telnet works fine.

However, I need to find a way to call telnet from the ssh command when I issue this command:

ssh FIRSTHOST 'telnet SECONDHOST'

(Yes, I am supposed to make this command work.)

When I try to login to the second host (after logging into the first), the input is simply echoed to the screen, and not sent to the second host.

-- Added example from comments -----------
ssh 172.24.128.1 <RETURN> followed by telnet 172.20.1.1 WORKS but the command ssh 172.24.128.1 'telnet 172.20.1.1' will NOT connect properly to the telnet session; any keystokes are echoed without being processed.

An example below

[hmuser@localhost ~]$ ssh 172.24.128.1 'telnet 172.20.1.1'
hmuser@172.24.128.1's password:
Trying 172.20.1.1...
Connected to 172.20.1.1.
Escape character is '^]'.
Welcome to Microsoft Telnet Service login: sdf sdf

I have tried several options, including setting remote ports.

I can't seem to find anything on the web for this. Duplicating this would be good and finding a solution to this would be great.

8

1 Answer

Forcing TTY should solve this issue. Sorry for coming too late.

ssh -t FIRSTHOST 'telnet SECONDHOST'

Please mark it as a solution to remove this question from "unanswered".

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like