From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/221 Path: main.gmane.org!not-for-mail From: Laurent Bercot Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: How to make a "telnetd" using tcpsvd and bash ? Date: Mon, 11 Aug 2003 17:30:21 +0200 Message-ID: <20030811153021.GA22709@skarnet.org> References: <023d01c36013$26065460$1b1e15ac@pcb0087> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1060615805 31847 80.91.224.253 (11 Aug 2003 15:30:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 11 Aug 2003 15:30:05 +0000 (UTC) Original-X-From: supervision-return-459-gcsg-supervision=m.gmane.org@list.skarnet.org Mon Aug 11 17:30:04 2003 Return-path: Original-Received: from antah.skarnet.org ([212.43.221.114]) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 19mEcW-0000xW-00 for ; Mon, 11 Aug 2003 17:30:04 +0200 Original-Received: (qmail 22846 invoked by uid 76); 11 Aug 2003 15:30:21 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 22840 invoked by uid 1000); 11 Aug 2003 15:30:21 -0000 Mail-Followup-To: supervision@list.skarnet.org Original-To: supervision@list.skarnet.org Content-Disposition: inline In-Reply-To: <023d01c36013$26065460$1b1e15ac@pcb0087> User-Agent: Mutt/1.4i Xref: main.gmane.org gmane.comp.sysutils.supervision.general:221 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:221 > During the preparation of some material that should try to explain my > collegues about the wonderful world of easy daemon-making using either > "runit/ipsvd" or "daemontools/ucspi-tcp" I wanted to make a "sample telnetd" > using runsv, tcpsvd and bash... > > That sounds easy and I have it almost working, except that all of my typing > on the terminal goes into the log instead of going back to the termainal the > same goes for the "prompt" showing working-dir and username... The problem is that the shell on the server is not running in a terminal. telnetd (and sshd), when used interactively, creates a pty, and runs its child in it, so that the child runs exactly as if it wasn't invoked by some network server. Telnet-like protocols in interactive sessions are not so easily faked by just a tcpserver and a shell: they do something more, i.e. pseudo- terminal allocation and handling. This is one of the hairiest and ugliest parts of Unix - welcome to the machine. I had a try at it some time ago, using DJB's ptyget package to perform the server-side pseudo-terminal work. It kind of worked, but wasn't in the least cool, maintainable nor portable. Besides, I had no client support (you need to put the client terminal in raw mode, transmit SIGWINCH information, and so on). I gave up. But I still have the idea in the back of my mind. If you want to have a go at it, the ttymodes library, from skalibs (http://www.skarnet.org/software/skalibs/libttymodes.html), inspired from the ptyget package, may help you. Good luck, Jim. -- Ska