SSH, the Secure SHell, is an essential tool for many developers and administrators. SSH provides a way to establish encrypted, authenticated connections. The most common use of an SSH connection is to get a remote shell, but it’s possible to do many other things through SSH as well, including transferring files and tunneling other connections.
twisted.conch package adds SSH support to
Twisted. This chapter shows how you can use the modules in
twisted.conch to build SSH servers and clients.
The command line is an incredibly efficient interface for certain tasks. System administrators love the ability to manage applications by typing commands without having to click through a graphical user interface. An SSH shell is even better, as it’s accessible from anywhere on the Internet.
You can use
twisted.conch to create an SSH server
that provides access to a custom shell with commands you define. This shell
will even support some extra features like command history, so that you can scroll
through the commands you’ve already typed.
Write a subclass of
twisted.conch.recvline.HistoricRecvLine that implements your shell
HistoricRecvLine is similar to
twisted.protocols.basic.LineReceiver, but with
higher-level features for controlling the terminal.
To make your shell
available through SSH, you need to implement a few different classes that
twisted.conch needs to build an SSH server. First, you