Skip to main content

Expose documentation via SSH - browse docs using familiar Unix commands

Project description

SSH-Docs

PyPI version Python 3.8+ License: MIT

Expose documentation via SSH for developers and AI coding agents using familiar Unix-style commands.

SSH-Docs starts a read-only SSH server for a directory of files and gives connected users a small shell with commands like ls, cd, cat, find, grep, head, tail, pwd, and help.

This generalizes the docs-over-SSH approach: instead of asking an agent to rely on stale context, you let it browse current markdown docs through the same shell workflow it already uses for code exploration.

Features

  • Read-only documentation browsing over SSH
  • Familiar shell commands for navigating and searching files
  • Zero-config startup with automatic content-root detection
  • Optional YAML configuration via .ssh-docs.yml
  • Public, password, or authorized-keys authentication modes
  • Built-in shell completion generation for Bash, Zsh, and Fish
  • Basic rate limiting controls in configuration
  • Automatic site-name detection from pyproject.toml, package.json, or the current directory

Installation

pip install ssh-docs

Quick Start

No-Auth Mode (Recommended for Agents)

The simplest way to start is with public (no-auth) mode, which is ideal for AI coding agents and local development:

# Serve with no authentication required
ssh-docs serve ./docs --auth public

# Or serve current directory with no auth
ssh-docs serve --auth public

Then connect without any credentials:

ssh localhost -p 2222

This mode is perfect for:

  • AI coding agents that need to browse documentation
  • Local development and testing
  • Internal networks where authentication isn't required
  • Quick documentation sharing

Basic Usage

# Serve an auto-detected docs directory (uses public auth by default)
ssh-docs serve

# Serve a specific directory
ssh-docs serve ./docs

# Use a custom port
ssh-docs serve ./docs --port 3000

If you bind to a non-default host or port, connect with the same values:

ssh 127.0.0.1 -p 3000

Available shell commands

Once connected, SSH-Docs exposes these commands:

pwd, ls, cd, cat, head, tail, find, grep, help, exit

Example session:

/site$ ls
/site$ cd guides
/site$ cat getting-started.md
/site$ grep -R "authentication" .
/site$ find . -name "*.md"
/site$ head -n 20 README.md
/site$ tail -n 10 changelog.txt
/site$ pwd
/site$ help
/site$ exit

CLI Commands

ssh-docs serve

Start the SSH documentation server.

Arguments:

  • CONTENT_DIR — directory to serve

Options:

  • -p, --port — port to listen on
  • -n, --site-name — site name shown in the shell/banner context
  • -c, --config — path to a config file
  • --host — host to bind to
  • --auth — authentication mode: public, key, or password
  • --keys-file — authorized keys file for key authentication
  • --password — password for password authentication
  • --no-config — ignore .ssh-docs.yml
  • --log-level — one of debug, info, warn, error

Examples:

ssh-docs serve ./docs
ssh-docs serve ./docs --port 3000 --site-name "My API Docs"
ssh-docs serve --auth password --password secret123
ssh-docs serve --config production.yml

ssh-docs init

Create a .ssh-docs.yml configuration file.

Options:

  • --interactive — prompt for common settings
  • --template — accepts basic or advanced

Examples:

ssh-docs init
ssh-docs init --interactive

ssh-docs validate

Validate a config file.

Examples:

ssh-docs validate
ssh-docs validate custom-config.yml

ssh-docs keygen

Generate SSH host keys.

Options:

  • --output-dir — output directory for generated keys
  • --force — overwrite existing keys

Examples:

ssh-docs keygen
ssh-docs keygen --output-dir ./keys

ssh-docs completion

Generate a shell completion script.

Required option:

  • --shell — one of bash, zsh, or fish

Examples:

ssh-docs completion --shell bash
ssh-docs completion --shell zsh
ssh-docs completion --shell fish

Configuration

SSH-Docs optionally loads .ssh-docs.yml from the current directory.

Example:

site_name: "My Project Documentation"
content_root: "./docs"
port: 2222
host: "0.0.0.0"

auth:
  type: "public" # public, key, password
  # authorized_keys: "~/.ssh/authorized_keys"
  # password: "${SSH_DOCS_PASSWORD}"

server:
  banner: |
    Welcome to {site_name} Documentation
    Type 'help' for available commands
  max_connections: 10
  timeout: 300
  log_level: "info"
  # log_file: "./ssh-docs.log"

features:
  syntax_highlighting: false
  line_numbers: false
  search_index: false

ignore:
  - "*.pyc"
  - "__pycache__"
  - ".git"
  - "node_modules"

rate_limiting:
  enabled: true
  max_connections_per_ip: 3
  max_connections_per_minute: 10
  max_failed_auth_attempts: 5
  failed_auth_window_seconds: 300
  max_total_connections: 100

Config behavior

  • If no config file exists, SSH-Docs runs with defaults.
  • Relative content_root values are resolved relative to the config file.
  • Passwords can be read from environment variables like ${SSH_DOCS_PASSWORD}.
  • If content_root is not set explicitly, SSH-Docs auto-detects one of: docs/, documentation/, public/, dist/, otherwise it falls back to the current directory.

Authentication

Public access

Public mode disables authentication entirely:

ssh-docs serve ./docs --auth public

Password authentication

ssh-docs serve ./docs --auth password --password secret123

Or with an environment variable in config:

export SSH_DOCS_PASSWORD="secret123"
ssh-docs serve

Authorized keys authentication

ssh-docs serve ./docs --auth key --keys-file ~/.ssh/authorized_keys

Shell Completion

Generate and install completions for your shell.

Bash

ssh-docs completion --shell bash >> ~/.bashrc
source ~/.bashrc

Zsh

ssh-docs completion --shell zsh >> ~/.zshrc
source ~/.zshrc

Fish

ssh-docs completion --shell fish >> ~/.config/fish/config.fish
source ~/.config/fish/config.fish

Auto-Detection

SSH-Docs automatically detects:

  • Content root from docs/, documentation/, public/, or dist/
  • Site name from package.json, pyproject.toml, or the current directory

Requirements

  • Python 3.8+
  • asyncssh
  • click
  • pyyaml

Development

git clone https://github.com/kourgeorge/ssh-docs.git
cd ssh-docs
pip install -e .
python -m ssh_docs serve ./docs

Security Notes

  • File browsing is read-only
  • Content access is restricted to the configured content root
  • Authentication can be disabled, password-based, or key-based
  • Rate limiting settings are available in config
  • Logging can be configured with a log level and optional log file

License

MIT License.

Support


Made for developers who prefer the terminal.

Project details


Download files

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

Source Distribution

ssh_docs-0.1.2.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ssh_docs-0.1.2-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file ssh_docs-0.1.2.tar.gz.

File metadata

  • Download URL: ssh_docs-0.1.2.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for ssh_docs-0.1.2.tar.gz
Algorithm Hash digest
SHA256 88a152a0d158b829c240b1d3477855590025c57766c36c2080cedeec97cadfc7
MD5 0c9613433539f2a436ca01ff20f650b1
BLAKE2b-256 20eea3b5d8ee9c03c2b4d8b5d3d7a90a4a84928613cbb62e47eecd5bb780fe40

See more details on using hashes here.

File details

Details for the file ssh_docs-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ssh_docs-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for ssh_docs-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 01d38f5ed199929a9046b8b4b82fa22d10cf89eeca031e1a5f97e1d9d289f5ef
MD5 873d01f7c1311af4b71b9705333920af
BLAKE2b-256 d535561defb48f74a23b19b3aeee50d6d451bd6a39f11487d75f762de996bd69

See more details on using hashes here.

Supported by

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