supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Laurent Bercot <ska-supervision@skarnet.org>
Subject: Re: How to make a "telnetd" using tcpsvd and bash ?
Date: Mon, 11 Aug 2003 17:30:21 +0200	[thread overview]
Message-ID: <20030811153021.GA22709@skarnet.org> (raw)
In-Reply-To: <023d01c36013$26065460$1b1e15ac@pcb0087>

> 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


      reply	other threads:[~2003-08-11 15:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-11 14:16 Uffe Jakobsen
2003-08-11 15:30 ` Laurent Bercot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030811153021.GA22709@skarnet.org \
    --to=ska-supervision@skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).