ssh2-python
Bindings for libssh2 C library
Decision gist · record as of 2026-08-14
Yes, if you need direct libssh2 bindings and understand the low-level API. No, if you want a simple SSH client—higher-level alternatives are recommended. The package is stable, actively maintained, has no known vulnerabilities, and offers good platform coverage. The LGPL-2.1-only license requires derivative works to be released under the same license, which may constrain proprietary use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a working SSH server to connect to; this is a low-level C-API wrapper and demands manual session and channel lifecycle management.
- Binary wheels are provided for Linux, macOS, and Windows across Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14, with no runtime dependencies.
- Install friction is medium due to the compiled nature of the bindings, but pre-built wheels eliminate build-time complexity for most platforms.
License · maintenance · safety
LGPL-2.1-only (copyleft) — Licensed under LGPL-2.1-only (copyleft). Any derivative work or modification must be released under the same license; static linking or bundling may trigger additional obligations depending on your distribution model.
last release 2025-10-12 (306 days) · last repo commit 2026-06-12 · 235 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 316,997 downloads/mo, #7,669 on PyPI
Alternatives
Verify before relying
pip install ssh2-python
import ssh2
session = ssh2.Session()
session.handshake('hostname')
session.userauth_password('user', 'password')
channel = session.open_session()
channel.execute('ls')
size, data = channel.read()
print(data.decode())- Whether the package supports key-based authentication or only password authentication.
- What the minimum Python version is (requires_python is unspecified in metadata).
- Whether PyPy support is actively tested or only declared in classifiers.
What it is and what it does
ssh2-python is a thin Python wrapper around libssh2, the C library that implements the SSH2 protocol. It exposes the low-level libssh2 API directly to Python, allowing developers to perform SSH operations with minimal overhead. The package is distributed as pre-compiled binary wheels for major platforms and Python versions, with no runtime dependencies.
This is intentionally a low-level binding, not a high-level client library. It requires manual management of sessions, channels, and authentication, and substantial boilerplate code for common tasks. The documentation explicitly recommends that most developers use higher-level clients instead, which provide a simpler interface built on top of ssh2-python. Use ssh2-python only if you need direct control over libssh2 semantics or are building a specialized SSH tool.
Use it for
- Building a custom SSH client or server with fine-grained control over protocol behavior and performance.
- Implementing SSH functionality in performance-critical applications where C-API overhead matters.
- Porting existing libssh2 C code examples to Python with minimal changes.
- Creating SSH automation tools that require low-level session and channel manipulation.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need direct libssh2 bindings and understand the low-level API.
No, if you want a simple SSH client—higher-level alternatives are recommended. The package is stable, actively maintained, has no known vulnerabilities, and offers good platform coverage. The LGPL-2.1-only license requires derivative works to be released under the same license, which may constrain proprietary use.
Install
ssh2-python on PyPI
Before you install
Binary wheels are provided for Linux, macOS, and Windows across Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14, with no runtime dependencies. Install friction is medium due to the compiled nature of the bindings, but pre-built wheels eliminate build-time complexity for most platforms. Repository is actively maintained with a recent commit on 2026-06-12.
Requires a working SSH server to connect to; this is a low-level C-API wrapper and demands manual session and channel lifecycle management.
License in practice
Licensed under LGPL-2.1-only (copyleft). Any derivative work or modification must be released under the same license; static linking or bundling may trigger additional obligations depending on your distribution model.
Quickstart
pip install ssh2-python
import ssh2
session = ssh2.Session()
session.handshake('hostname')
session.userauth_password('user', 'password')
channel = session.open_session()
channel.execute('ls')
size, data = channel.read()
print(data.decode())
Verify before relying
- Whether the package supports key-based authentication or only password authentication.
- What the minimum Python version is (requires_python is unspecified in metadata).
- Whether PyPy support is actively tested or only declared in classifiers.
Package facts
| License | LGPL-2.1-only copyleft |
| Python support | Not specified |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 306 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 316,997 / month, #7,669 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: BSDOperating System :: POSIX :: LinuxProgramming Language :: CProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: System :: NetworkingTopic :: System :: Shells |
Evidence: ssh2_python-1.2.0.post1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; ssh2_python-1.2.0.post1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; ssh2_python-1.2.0.post1-cp310-cp310-win_amd64.whl; ssh2_python-1.2.0.post1-cp311-cp311-macosx_12_0_arm64.whl; ssh2_python-1.2.0.post1-cp311-cp311-macosx_13_0_arm64.whl; ssh2_python-1.2.0.post1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; ssh2_python-1.2.0.post1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; ssh2_python-1.2.0.post1-cp311-cp311-win_amd64.whl; ssh2_python-1.2.0.post1-cp312-cp312-macosx_14_0_arm64.whl; ssh2_python-1.2.0.post1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; ssh2_python-1.2.0.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; ssh2_python-1.2.0.post1-cp312-cp312-win_amd64.whl; ssh2_python-1.2.0.post1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; ssh2_python-1.2.0.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; ssh2_python-1.2.0.post1-cp313-cp313-win_amd64.whl; ssh2_python-1.2.0.post1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; ssh2_python-1.2.0.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; ssh2_python-1.2.0.post1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; ssh2_python-1.2.0.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; ssh2_python-1.2.0.post1-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “ssh2 protocol bindings”
- ssh2-pythonssh2-python provides Python bindings to libssh2, a low-level SSH2…
- zhinst-commszhinst-comms provides protocol stack bindings to communicate with…
- sentry-protosProvides protocol buffer and gRPC schema definitions for…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also ssh-python · paramiko · fs.sshfs · installer · parallel-ssh · sshtunnel · scp · jumpssh · PyNaCl · asyncssh