PySSH

Introduction

What is PySSH?

PySSH is a Python library for programmatically controlling ssh and scp.

Give me an example.

import pyssh
pyssh.run('date', host=HOST, user=USER)

You can also add a password=PASSWORD argument, if you haven't set up RSA key pairs.

Who developed PySSH?

Chuck Esterbrook with examples (and code lifted) from Drew McDowell and Adam Grzegorz.

How mature is PySSH?

PySSH has been tested on and works with Linux. However, there are some bizarre characteristics of the module including time.sleep() call without which it won't work, as well as merged stdin and stdout from the ssh child process. Your mileage may vary.

Where can I get releases and news?

At the home page at http://pyssh.sourceforge.net/.

How can I contribute?

Check the To Do list if you're looking for something, or inquire on the discussion list. Share any patches, enhancements, modules, docs, etc. that you wish via the discussion list as well. pyssh-discuss@lists.sourceforge.net

License

We use the Python license. See license.txt.

Getting Started

Requirements

PySSH requires Python 2.0 or greater and uses the pty module found in Python, but only for IRIX and Linux. If you can use PySSH on other platforms, particularly some flavor of POSIX, please let us know.

Installation

For a single user, copy the pyssh.py module to a location in your PYTHONPATH.

For a system, become the administrator and run python setup.py install at the command prompt.

Testing your installation

The pyssh.py module can be run as a program with command line arguments to run ssh. This is useful for testing:
> python pyssh.py host=HOST user=USER command=date password=PASSWORD

You can skip the password if you have set up RSA key pairs.

If this doesn't work, try using your ordinary ssh program first:

> ssh USER@HOST COMMAND

If ssh works, but pyssh does not, turn debugging on with "debug=1" passed on the command line and contact pyssh-discuss.

Using PySSH

run()

The run() function is the most basic way to use pyssh:
import pyssh
pyssh.run('date', host=HOST, user=USER, password=PASSWORD)

The doc string contains more info. The source code for pyssh contains additional classes and functionality you can read through.

Links

Docs:

PySSH home:

SSH info:

Release Instructions

This section contains instructions on how to cut a release. @@


Copyright © 2001 by the PySSH Development Team