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?

  • 1
    I haven't used telnet in ages but try using ssh -t -o ... in your command. Does that help? – Jim L. May 10 '19 at 23:03
  • @JimL. Yes, that diod help! Excellent, you can move the comment to an answer and i gladly will accept! Thanks! – stdcerr May 13 '19 at 18:32

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

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.