My plan is to offer a route-server, which is a small interactive program, via telnet to the world. Like this: telnet://route-server.he.net

As a minimal example, I'd start with a simple bash, offered via socat:

socat TCP-LISTEN:9001,reuseaddr,crnl,fork EXEC:bash,pty,stderr,sane,setsid,sigint,echo=0

Now I connect using telnet:

$ telnet localhost 9001

And it seems to work at first:

$ echo foo

The problem is: some special characters like ESC, arrow keys, etc. are printed as their shell escape codes. Example for 'arrow up':

$ ^[[A

Also, clicking/scrolling/... prints escape codes, too:

$ ^[[M r>^[[M#r>

The question is: how can I fix this behaviour in a way that clients can continue using telnet without any client side options or hacks, as it does on existing route-servers out there.

  • Use in.telnetd, which already offers interactive shell. Don't reinvent the wheel. Commented Aug 30, 2016 at 17:00

1 Answer 1


Based on ipors comment we managed to run the service with following setup:

xinetd runs telnetd from GNU Inetutils (ftp://ftp.gnu.org/gnu/inetutils/)

server = /path/to/custom/telnetd

In the server_args, we defined an exec-String which points to a wrapper-script to run our birdc with the required options

server_args = -h -E "/opt/bird-telnet.sh"

/opt/bird-telnet.sh looks like

/usr/sbin/birdc -r -s /var/run/bird/bird.ctl

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .