2

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?

stdcerr
  • 2,037
  • 12
  • 42
  • 65
  • 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

1 Answers1

1

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
Jim L.
  • 7,188
  • 1
  • 13
  • 25