Skip to main content

how do I tab in telnet when executing it on remote host by ssh? [Resolved]

How can I use tab when I use telnet on a remote host by ssh, I have something like:

ssh -o StritHopstKeyChecking=no -p port user@hostA telnet hostB; echo "Reconnect?"; while read < /dev/tty; do ssh -o StritHopstKeyChecking=no -p port user@hostA telnet hostB; done 

which launches the telnet session to hostB from hostA fine but inside telnet, I can't use tab for auto-completion which I can use fine when I manually ssh into hostA and then telnet to hostB from there. Any ideas?

Question Credit: cerr
Question Reference
Asked May 13, 2019
Posted Under: Unix Linux
1 Answers

In some situations, it is helpful to use the -t option to tell ssh to allocate a pseudo-terminal device for the ssh connection:

ssh -t -o StrictHostKeyChecking=no -p port user@hostA telnet hostB

Another typical example of a command that requires -t is remote editing of a file with vi, or viewing it with less:

ssh -t -o StrictHostKeyChecking=no -p port user@hostA vi foo.txt

credit: Jim L.
Answered May 13, 2019
Your Answer