Skip to content

Bindings for libssh C library.

License

LGPL-2.1, LGPL-2.1 licenses found

Licenses found

LGPL-2.1
LICENSE
LGPL-2.1
COPYING
Notifications You must be signed in to change notification settings

enkore/ssh-python

Repository files navigation

ssh-python

Bindings for libssh C library.

LicenseLatest Versionhttps://circleci.com/gh/ParallelSSH/ssh-python/tree/master.svg?style=shieldhttps://ci.appveyor.com/api/projects/status/2t4bmmtjvfy5s1in/branch/master?svg=trueLatest documentation

Installation

Binary wheels are provided for Linux (manylinux 2010), OSX (10.14 and 10.15 for brew Python), and Windows 64-bit (Python 3.6/3.7/3.8).

Wheels have no dependencies. For building from source, see documentation.

pip install ssh-python

Project is beta status, please report any issues.

Quick Start

from __future__ importprint_functionimportosimportpwdfromssh.sessionimportSessionfromsshimportoptions# Linux onlyUSERNAME=pwd.getpwuid(os.geteuid()).pw_nameHOST='localhost's=Session() s.options_set(options.HOST, HOST) s.connect() # Authenticate with agents.userauth_agent(USERNAME) chan=s.channel_new() chan.open_session() chan.request_exec('echo me') size, data=chan.read() whilesize>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 released as much as possible
    • libssh threading limitations apply - anything not supported in C is not supported in Python
  • Very low overhead thin wrapper
  • Object oriented
    • Memory freed automatically and safely as objects are garbage collected by Python
  • Uses Python semantics where applicable
    • channel/file handle context manager support
    • channel/file handle iterator support
  • Raises low level C errors as Python exceptions

About

Bindings for libssh C library.

Resources

License

LGPL-2.1, LGPL-2.1 licenses found

Licenses found

LGPL-2.1
LICENSE
LGPL-2.1
COPYING

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C85.8%
  • Python8.3%
  • CMake3.7%
  • C++1.1%
  • CSS0.9%
  • Shell0.1%
  • Other0.1%