Skip to main content

Wrapper for libssh C library.

Project description

Bindings for libssh C library.

License Latest Version

Installation

Currently only installation from source is provided. Binary wheels to follow.

To install from source, run the following:

pip install ssh-python

Project is beta status.

Prerequisites

  • OpenSSL or gcrypt library and development headers

  • Optionally Zlib library and development headers for compression

Libssh source code is embedded in this project and will be built when installation is triggered per above instructions. Versions of libssh other than the one embedded in this project are not supported.

Quick Start

from __future__ import print_function

import os
import pwd

from ssh.session import Session
from ssh import options

USERNAME = pwd.getpwuid(os.geteuid()).pw_name
HOST = 'localhost'

s = Session()
s.options_set(options.HOST, HOST)
s.connect()

# Authenticate with agent
s.userauth_agent(USERNAME)

chan = s.channel_new()
chan.open_session()
chan.request_exec('echo me')
size, data = chan.read()
while size > 0:
    print(data.strip())
    size, data = chan.read()
chan.close()

Output:

me

Features

The library uses Cython based native code extensions as wrappers to libssh.

  • Thread safe - GIL is released as much as possible

  • Very low overhead thin wrapper

  • Object oriented - memory freed automatically and safely as objects are garbage collected by Python

  • Use Python semantics where applicable, such as context manager and iterator support for opening and reading from channels and SFTP file handles

  • Raise errors as Python exceptions

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ssh-python-0.2.0.tar.gz (1.1 MB view details)

Uploaded Source

File details

Details for the file ssh-python-0.2.0.tar.gz.

File metadata

  • Download URL: ssh-python-0.2.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ssh-python-0.2.0.tar.gz
Algorithm Hash digest
SHA256 59010c5b06428c4ad0dba250b4f69ac4a9103423869e419d6afe20843192e1aa
MD5 307f4cd37215d80cbed52add5c2e97d1
BLAKE2b-256 c9d7c03e43f63b3c7b6425156d21aface328ce8199145ff49056375b13616ea2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page