Sending ^] in a nested telnet session

2

Following is the sequence:

  • Telnet from a terminal session to a remote linux machine, Call it A.
  • Telnet to some device, Say B, that is accessible only from A.

Now, How do I quit the telnet session to B and stay live on A?

Mallik

Posted 2012-03-06T17:29:10.110

Reputation: 376

Answers

3

Using the inetutils version of telnet client, you can use the send escape command:

a$ telnet b
  b$ telnet c
    c$ ^]
telnet> send escape
  telnet> q
  b$

Or use the logout/disconnect command of C:

a$ telnet b
  b$ telnet c
    c$ exit
  b$

And stop using telnet, damn it.

user1686

Posted 2012-03-06T17:29:10.110

Reputation: 283 655

2the first solution worked for me,... and I can not use logout or exit because c is not a linux machine, its an embedded box... – Mallik – 2012-03-07T05:22:41.333

1

Could you use a different escape sequence when logging in to either A or B? For example,

telnet -e ^Q A
telnet B

gives you ^Q on A and ^[ on B.

taneli

Posted 2012-03-06T17:29:10.110

Reputation: 121

Thanks for the solution, But the problem is I am not using telnet program directly, but it is being used inside the script that I use to log in to the box... Thanks anyways... – Mallik – 2012-03-07T05:20:54.393

1You should be able to change the escape character from the escape mode as well: press ^], tell telnet to set escape ^Q (or whetever) and carry on. – taneli – 2012-03-07T08:37:20.403