Home |
Licence |
FAQ |
Docs |
Download |
Keys |
Links
Mirrors |
Updates |
Feedback |
Changes |
Wishlist |
Team
It would be nice to be able to use PuTTY as a local terminal window
application for Cygwin shell sessions: a sort of local
xterm
-alike (or rather, pterm
-alike).
This is a perfectly feasible piece of work (much, much more so than the superficially similar-looking but far more difficult win-command-prompt), and in fact it can just about be achieved without any actual changes to PuTTY. PuTTY's support for talking to a local Windows proxy subprocess in place of making a network connection permits a solution in which that proxy subprocess sets up a Cygwin pseudo-terminal, and speaks Telnet on its standard input and output (which connect to PuTTY). So you would configure PuTTY to think it was making a telnet connection to localhost, but actually interpose this helper program via the Proxy configuration panel – and the effect is that PuTTY speaks directly to the Telnet implementation in the helper program, which starts a Cygwin pty and runs a shell in it.
So the helper process has to be a Cygwin application (it must link
against the Cygwin DLL so it can work with the Cygwin emulation of
ptys), and it needs to speak Telnet on its standard I/O channels and
at the other end talk to a pty. In other words, it's actually very
similar to a Unix telnet daemon, of the type that can be launched
from inetd
.
In fact, it would be really nice if Cygwin's
own telnetd
could be used to do this job. Then an
unmodified PuTTY could talk to an unmodified Cygwin installation with
only a mildly fiddly piece of configuration.
However, when I actually tried this I found that Cygwin's telnet
server wouldn't quite do the job: for instance, it wouldn't operate in
the absence of syslogd, and it didn't have a command-line option to
make it invoke some program other than login
in its
pseudo-terminal. I wouldn't expect that those should be difficult
features to add, but I've never got round to making a serious effort
to write them properly and get them accepted upstream.
However, I have written a small and specialist Telnet server of my own which is suitable for this job. (That was a lot less work than it sounds, since several pieces of PuTTY were easily reused to do most of the heavy lifting – client-side and server-side Telnet are very similar.) I'm just not sure how to sensibly package it, since really it should be a Cygwin application so as to work with Cygwin installations of all versions, but in that case it's better just to adapt Cygwin telnetd...
In the meantime, though, for anyone who wants to use it, here's the (currently rather long and involved) process for setting it up:
contrib/cygtermd
of the PuTTY source tree.
(You can get the PuTTY source code from
the Download page, as a zip or tar file
or by checking it out from Subversion.)
contrib/cygtermd
directory, run the
Cygwin make
command. (You will need
Cygwin's make
and gcc
installed.) This will
create an executable file called cygtermd.exe
.
cygtermd.exe
into Cygwin's /bin
directory. (This is unfortunately necessary because it will be run by
a non-Cygwin application and will therefore need to be in the same
directory as the Cygwin DLL in order to find it.)
c:\cygwin\bin\cygtermd.exe /home/simon /bin/bash -loginwhich would arrange that the helper program will be run in Cygwin's
/home/simon
directory, and will launch the
program "/bin/bash -login
" (i.e. a normal Cygwin login
shell) inside the telnet session.
This is all a lot of hassle, even though it only has to be set up once. If Cygwin telnetd were fixed so that it could do the job of my cygtermd utility, I would probably think it reasonable to add a piece of dedicated PuTTY user interface to make it trivially easy to run a local Cygwin shell session.
Our Links page links to a modified version of PuTTY called PuTTYcyg, which was able to act as a Cygwin local terminal (again using a helper process linked against Cygwin) before PuTTY proper could do so.
Audit trail for this wish.