Skip to main content

autossh

Usage:

from autossh import AutoSSHTunnel  

with AutoSSHTunnel(
    ssh_server='ssh.example.com', 
    ssh_username='your_username', 
    ssh_password='your_password', 
    remote_host='remote.example.com', 
    remote_port=3306, 
    local_port=5000,
    ssh_port=2222   
) as tunnel:
    info = tunnel.get_tunnel_info()
    print(f"SSH tunnel established from local port {info['local_port']} to {info['remote_host']}:{info['remote_port']}")
    print(f"Tunnel is active: {'Yes' if info['is_active'] else 'No'}")

Or:

from autossh import AutoSSHTunnel  

tunnel = AutoSSHTunnel(
    ssh_server='ssh.example.com', 
    ssh_username='your_username', 
    ssh_password='your_password', 
    remote_host='remote.example.com', 
    remote_port=3306, 
    local_port=5000,
    ssh_port=2222  
)

tunnel.start()

try:
    info = tunnel.get_tunnel_info()
    print(f"SSH tunnel established from local port {info['local_port']} to {info['remote_host']}:{info['remote_port']}")
    print(f"Tunnel is active: {'Yes' if info['is_active'] else 'No'}")
finally:
    tunnel.stop()

Or with cli:

autossh-py your_username@ssh.example.com -L 5000:remote.example.com:3306 -p 2222

If you want to use in backend, you can specify password with sshpass and use nohup &:

Install sshpass as per: https://gist.github.com/arunoda/7790979 and:

nohup sshpass -p your_password autossh-py -p 2222 -L 5000:remote.example.com:3306 your_username@ssh.example.com &

Also support ssh key:

autossh-py -i ~/your_key -L 3306:localhost:3306 your_username@ssh.example.com

Metadata

Release files for autossh 0.0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autossh 0.0.1.3
File Size Uploaded Provenance
autossh-0.0.1.3.tar.gz 4.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for autossh 0.0.1.3
File Interpreter ABI Platform
autossh-0.0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / autossh-0.0.1.3.tar.gz

Download URL autossh-0.0.1.3.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
952a39d6fab3de564f68250c3c6fb5977fd0d9582d3f56ec9e4460aa1b84ca47
BLAKE2b-256 checksum
How to use checksums
e509d8da7510d654b3f7556922ccf06e3a1a5f3ccf3ed200d4e340f9d523b6eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Release files / autossh-0.0.1.3-py3-none-any.whl

Download URL autossh-0.0.1.3-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9284f60f0f1f463cc99a2bf973cce65227ed3ebe634a9c42f4e068d0369fcebf
BLAKE2b-256 checksum
How to use checksums
522f660cd5b8181b438abc5242c74fc685a089947ba0a44245380fcde2129db0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Security for autossh 0.0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page