skillfed

ansible-pylibssh

Python bindings for libssh client specific to Ansible use case

ansible-pylibssh v1.4.0 296.0K downloads/30d#7,907 on PyPI80
Copyleft license LGPLv2+ Active released

What it is and what it does

ansible-pylibssh is a Python wrapper around the libssh C library, providing direct access to SSH client functionality optimized for Ansible's use case. It bridges the gap between Python and libssh by exposing session management, connection handling, and SSH operations through a Python API, allowing Ansible and other tools to perform SSH operations programmatically without shelling out to external commands.

The package is a compiled C extension (Cython-based) that requires libssh 0.9.0+ to be installed on the system. Recent versions (1.4.0) integrate libssh logging into Python's standard logging system, allowing fine-grained control over SSH debug output and performance tuning. It supports Python 3.9 through 3.14 and provides prebuilt wheels for macOS and multiple Linux architectures, though custom builds require a C compiler and libssh development headers.

Use it for:

  • Integrate SSH connectivity into Ansible automation without spawning external SSH processes.
  • Debug SSH connection issues by routing libssh logs through Python's logging system and setting trace levels.
  • Build custom SSH-based tools or orchestration scripts that need direct libssh functionality rather than subprocess wrappers.
  • Support Ansible on platforms where native SSH binaries are unavailable or where direct C-level SSH control is required.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Python bindings to libssh that provide SSH client functionality tailored for Ansible, enabling programmatic SSH connections and operations from Python.

Yes, with conditions. Install if you are building Ansible-related tools or need direct libssh integration in Python and have libssh 0.9.0+ available on your system. The copyleft license (LGPLv2+) requires careful review in proprietary contexts. The Pre-Alpha classifier suggests API stability is not guaranteed, so pin versions carefully. No known security vulnerabilities as of the fact sheet date.

Install

ansible-pylibssh on PyPI

pip

pip install ansible-pylibssh

uv

uv add ansible-pylibssh

poetry

poetry add ansible-pylibssh

Installing ansible-pylibssh

Before you install

Medium install friction due to compiled C extension requiring libssh 0.9.0+ to be present on the system. Wheels are available for Python 3.9–3.14 across multiple architectures (x86_64, aarch64, ppc64le, s390x, armv7l) and macOS 15.0+, reducing build burden on supported platforms. Project is actively maintained with recent releases.

License in practice

Licensed under LGPLv2+, a copyleft license. Any derivative work or modification must be distributed under compatible terms; static linking or redistribution may require source disclosure. Suitable for open-source projects but requires careful review in proprietary contexts.

Quickstart

pip install ansible-pylibssh

from ansible_pylibssh import Session

ssh = Session()
ssh.connect(host='example.com', user='admin')

libssh 0.9.0 or later must be installed on the system; Python 3.9+ is required. Prebuilt wheels exist for common platforms but custom builds need a C compiler and libssh development headers.

Verify before relying

  • Whether the package supports key-based authentication, password auth, and other standard SSH mechanisms beyond what the changelog mentions.
  • Performance characteristics and typical use patterns within Ansible's infrastructure.
  • Stability guarantees given the 'Pre-Alpha' development status classifier despite active maintenance.

Package facts

License LGPLv2+ (copyleft)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 151 days since the last release
Last repo commit
First released
Downloads 295,978/month — #7,907 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ansible_pylibssh-1.4.0-cp310-cp310-macosx_15_0_x86_64.whl; ansible_pylibssh-1.4.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; ansible_pylibssh-1.4.0-cp310-cp310-manylinux_2_27_ppc64le.manylinux_2_28_ppc64le.whl; ansible_pylibssh-1.4.0-cp310-cp310-manylinux_2_27_s390x.manylinux_2_28_s390x.whl; ansible_pylibssh-1.4.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; ansible_pylibssh-1.4.0-cp310-cp310-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl; ansible_pylibssh-1.4.0-cp311-cp311-macosx_15_0_x86_64.whl; ansible_pylibssh-1.4.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; ansible_pylibssh-1.4.0-cp311-cp311-manylinux_2_27_ppc64le.manylinux_2_28_ppc64le.whl; ansible_pylibssh-1.4.0-cp311-cp311-manylinux_2_27_s390x.manylinux_2_28_s390x.whl; ansible_pylibssh-1.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; ansible_pylibssh-1.4.0-cp311-cp311-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl; ansible_pylibssh-1.4.0-cp312-cp312-macosx_15_0_x86_64.whl; ansible_pylibssh-1.4.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; ansible_pylibssh-1.4.0-cp312-cp312-manylinux_2_27_ppc64le.manylinux_2_28_ppc64le.whl; ansible_pylibssh-1.4.0-cp312-cp312-manylinux_2_27_s390x.manylinux_2_28_s390x.whl; ansible_pylibssh-1.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; ansible_pylibssh-1.4.0-cp312-cp312-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl; ansible_pylibssh-1.4.0-cp313-cp313-macosx_15_0_x86_64.whl; ansible_pylibssh-1.4.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Keywords: cython, cext, libssh

Development Status :: 2 - Pre-AlphaLicense :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)Operating System :: MacOSOperating System :: POSIX :: LinuxProgramming Language :: CythonProgramming 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.9Topic :: SecurityTopic :: Software Development :: Libraries :: Python Modules

Tags

libssh python bindingsssh client library pythonansible ssh connectivitypython ssh automationlibssh wrapper pythonssh session management
ssh-clientlibssh-bindingsansible-integration

More Python Modules packages