Getting a TTY in a Connectback Shell

Posted by Asad R. on Server Fault See other posts from Server Fault or by Asad R.
Published on 2010-01-13T14:03:58Z Indexed on 2010/03/24 22:03 UTC
Read the original article Hit count: 481

Filed under:
|
|

I'm often asked by friends to help with small Linux problems, and more often than not I'm required to login to the remote system. Usually there are a lot of issues with making an account and logging in (sometimes the box is behind a NAT device, sometimes SSHD isn't installed, etc.) so I usually just ask them to make a connect-back shell using netcat (nc -e /bin/bash ). If they don't have netcat I can just ask them to grab a copy of a statically compiled binary which isn't that hard or time consuming to download and run.

Though this works well enough for me to enter simple commands, I can't run any apps that require a tty (vi, for example) and can't use any job control functions. I managed to bypass this issue by running in.telnetd with a few arguments within the connect-back shell that would assign me a terminal and drop me to a shell. Unfortunately in.telnetd isn't usually installed by default on most systems.

What's the easiest way to get a fully functional connect-back terminal shell without requiring any non-standard packages?

(A small C program that does the job would be fine as well, I just can't seem to find much documentation on how a TTY is assigned/allocated. A solution that doesn't require me to plough through the source code for SSHD and TELNETD would be nice :))

© Server Fault or respective owner

Related posts about linux

Related posts about netcat