sshconf
Lightweight SSH config library.
What it is and what it does
sshconf is a lightweight library for reading and writing SSH configuration files programmatically. It parses the standard SSH config format and lets you query, add, modify, and remove host entries while preserving the file's original formatting and comments—important because SSH config files are often hand-edited and need to remain readable.
The library provides methods to read an existing config, inspect host settings, update individual hosts or create new ones, rename entries, and write changes back to the file or to a new file. It automatically detects indentation from existing config lines and handles multi-value directives like RemoteForward. Since it has no runtime dependencies and requires only Python 3.5 or later, it integrates easily into automation scripts, configuration management tools, or any application that needs to manage SSH access programmatically.
Use it for:
- Automate SSH host configuration in deployment or infrastructure-as-code scripts.
- Build configuration management tools that need to update SSH settings without breaking manual edits.
- Generate SSH config entries dynamically from a database or API of hosts and credentials.
- Programmatically manage SSH tunnels, port forwards, or jump-host configurations.
- Parse and audit existing SSH configs to validate host settings or compliance policies.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
sshconf reads and modifies SSH config files while preserving their formatting and structure, letting you programmatically manage SSH host entries and settings.
Yes. sshconf is a straightforward, actively maintained tool with no dependencies, permissive licensing, and a clear use case. Install it if you need to read or modify SSH config files from Python code; skip it if you only work with SSH configs manually or through shell scripts.
Install
sshconf on PyPI
pip
pip install sshconfuv
uv add sshconfpoetry
poetry add sshconfInstalling sshconf
Before you install
No runtime dependencies and a pure-Python wheel distribution keep installation friction minimal. The package is actively maintained with a recent commit history.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for most projects.
Quickstart
from sshconf import read_ssh_config
from os.path import expanduser
c = read_ssh_config(expanduser("~/.ssh/config"))
print(c.hosts())
c.set("myhost", Hostname="example.com", Port=22)
c.save()
Verify before relying
- Whether the library handles all SSH config directives and edge cases reliably in production use.
- Performance characteristics when working with very large or complex SSH config files.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 776 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 500,008/month — #6,323 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sshconf-0.2.7-py3-none-any.whl
Keywords: ssh, config
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
sshtunnelEstablishes SSH tunnels to forward local ports…
permissive · top 1,000 on PyPI
fs.sshfsfs.sshfs provides a PyFilesystem2 interface to…
copyleft · top 15,000 on PyPI
netconf-clientA NETCONF client library for Python that…
permissive · top 15,000 on PyPI
parallel-sshAsynchronous SSH client for running commands on…
copyleft · top 15,000 on PyPI
sshfsProvides an fsspec-compatible filesystem…
permissive · top 5,000 on PyPI
dvc-sshAdds SSH remote storage support to DVC,…
permissive · top 15,000 on PyPI
paramiko-expectParamiko Expect adds expect-like pattern…
permissive · top 15,000 on PyPI
sshuttlesshuttle creates a transparent proxy that…
copyleft · top 15,000 on PyPI
fabricFabric executes shell commands remotely over…
permissive · top 5,000 on PyPI
spurProvides a unified Python interface to run…
permissive · top 15,000 on PyPI