asyncssh 2.21.1


pip install asyncssh

  Latest version

Released: Sep 28, 2025


Meta
Author: Ron Frederick
Requires Python: >=3.6

Classifiers

Development Status
  • 5 - Production/Stable

Environment
  • Console

Intended Audience
  • Developers

License
  • OSI Approved

Operating System
  • MacOS :: MacOS X
  • POSIX

Programming Language
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

Topic
  • Internet
  • Security :: Cryptography
  • Software Development :: Libraries :: Python Modules
  • System :: Networking
Documentation Status AsyncSSH PyPI Project

AsyncSSH: Asynchronous SSH for Python

AsyncSSH is a Python package which provides an asynchronous client and server implementation of the SSHv2 protocol on top of the Python 3.6+ asyncio framework.

import asyncio, asyncssh, sys

async def run_client():
    async with asyncssh.connect('localhost') as conn:
        result = await conn.run('echo "Hello!"', check=True)
        print(result.stdout, end='')

try:
    asyncio.get_event_loop().run_until_complete(run_client())
except (OSError, asyncssh.Error) as exc:
    sys.exit('SSH connection failed: ' + str(exc))

Check out the examples to get started!

Features

  • Full support for SSHv2, SFTP, and SCP client and server functions

    • Shell, command, and subsystem channels

    • Environment variables, terminal type, and window size

    • Direct and forwarded TCP/IP channels

    • OpenSSH-compatible direct and forwarded UNIX domain socket channels

    • OpenSSH-compatible TUN/TAP channels and packet forwarding

    • Local and remote TCP/IP port forwarding

    • Local and remote UNIX domain socket forwarding

    • Dynamic TCP/IP port forwarding via SOCKS

    • X11 forwarding support on both the client and the server

    • SFTP protocol version 3 with OpenSSH extensions

      • Experimental support for SFTP versions 4-6, when requested

    • SCP protocol support, including third-party remote to remote copies

  • Multiple simultaneous sessions on a single SSH connection

  • Multiple SSH connections in a single event loop

  • Byte and string based I/O with settable encoding

  • A variety of key exchange, encryption, and MAC algorithms

    • Including post-quantum kex algorithms ML-KEM and SNTRUP

  • Support for gzip compression

    • Including OpenSSH variant to delay compression until after auth

  • User and host-based public key, password, and keyboard-interactive authentication methods

  • Many types and formats of public keys and certificates

    • Including OpenSSH-compatible support for U2F and FIDO2 security keys

    • Including PKCS#11 support for accessing PIV security tokens

    • Including support for X.509 certificates as defined in RFC 6187

  • Support for accessing keys managed by ssh-agent on UNIX systems

    • Including agent forwarding support on both the client and the server

  • Support for accessing keys managed by PuTTY’s Pageant agent on Windows

  • Support for accessing host keys via OpenSSH’s ssh-keysign

  • OpenSSH-style known_hosts file support

  • OpenSSH-style authorized_keys file support

  • Partial support for OpenSSH-style configuration files

  • Compatibility with OpenSSH “Encrypt then MAC” option for better security

  • Time and byte-count based session key renegotiation

  • Designed to be easy to extend to support new forms of key exchange, authentication, encryption, and compression algorithms

License

This package is released under the following terms:

Copyright (c) 2013-2024 by Ron Frederick <ronf@timeheart.net> and others.

This program and the accompanying materials are made available under the terms of the Eclipse Public License v2.0 which accompanies this distribution and is available at:

http://www.eclipse.org/legal/epl-2.0/

This program may also be made available under the following secondary licenses when the conditions for such availability set forth in the Eclipse Public License v2.0 are satisfied:

GNU General Public License, Version 2.0, or any later versions of that license

SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later

For more information about this license, please see the Eclipse Public License FAQ.

Prerequisites

To use AsyncSSH 2.0 or later, you need the following:

  • Python 3.6 or later

  • cryptography (PyCA) 3.1 or later

Installation

Install AsyncSSH by running:

pip install asyncssh

Optional Extras

There are some optional modules you can install to enable additional functionality:

AsyncSSH defines the following optional PyPI extra packages to make it easy to install any or all of these dependencies:

bcrypt
fido2
gssapi
libnacl
pkcs11
pyOpenSSL
pywin32

For example, to install bcrypt, fido2, gssapi, libnacl, pkcs11, and pyOpenSSL on UNIX, you can run:

pip install 'asyncssh[bcrypt,fido2,gssapi,libnacl,pkcs11,pyOpenSSL]'

To install bcrypt, fido2, libnacl, pkcs11, pyOpenSSL, and pywin32 on Windows, you can run:

pip install 'asyncssh[bcrypt,fido2,libnacl,pkcs11,pyOpenSSL,pywin32]'

Note that you will still need to manually install the libsodium library listed above for libnacl to work correctly and/or libnettle for UMAC support. Unfortunately, since liboqs, libsodium, and libnettle are not Python packages, they cannot be directly installed using pip.

Installing the development branch

If you would like to install the development branch of asyncssh directly from Github, you can use the following command to do this:

pip install git+https://github.com/ronf/asyncssh@develop

Mailing Lists

Three mailing lists are available for AsyncSSH:

2.21.1 Sep 28, 2025
2.21.0 May 03, 2025
2.20.0 Feb 17, 2025
2.19.0 Dec 13, 2024
2.18.0 Oct 26, 2024
2.17.0 Sep 02, 2024
2.16.0 Aug 18, 2024
2.15.0 Jul 03, 2024
2.14.2 Dec 18, 2023
2.14.1 Nov 09, 2023
2.14.0 Oct 01, 2023
2.13.2 Jun 22, 2023
2.13.1 Feb 18, 2023
2.13.0 Dec 27, 2022
2.12.0 Aug 11, 2022
2.11.0 Jun 04, 2022
2.10.1 Apr 16, 2022
2.10.0 Mar 26, 2022
2.9.0 Jan 23, 2022
2.8.1 Nov 08, 2021
2.8.0 Nov 04, 2021
2.7.2 Sep 16, 2021
2.7.1 Sep 06, 2021
2.7.0 Jun 19, 2021
2.6.0 May 01, 2021
2.5.0 Dec 23, 2020
2.4.2 Sep 12, 2020
2.4.1 Sep 05, 2020
2.4.0 Aug 29, 2020
2.3.0 Jul 12, 2020
2.2.1 Apr 18, 2020
2.2.0 Feb 29, 2020
2.1.0 Nov 30, 2019
2.0.1 Nov 02, 2019
2.0.0 Oct 26, 2019
1.18.0 Aug 24, 2019
1.17.1 Jul 24, 2019
1.17.0 Jun 01, 2019
1.16.1 Mar 31, 2019
1.16.0 Mar 03, 2019
1.15.1 Jan 21, 2019
1.15.0 Nov 27, 2018
1.14.0 Sep 08, 2018
1.13.3 Jul 24, 2018
1.13.2 Jul 04, 2018
1.13.1 Jun 17, 2018
1.13.0 May 20, 2018
1.12.2 Apr 18, 2018
1.12.1 Mar 10, 2018
1.12.0 Feb 07, 2018
1.11.1 Nov 16, 2017
1.11.0 Sep 09, 2017
1.10.1 May 20, 2017
1.10.0 May 06, 2017
1.9.0 Feb 19, 2017
1.8.1 Dec 30, 2016
1.8.0 Dec 29, 2016
1.7.3 Nov 23, 2016
1.7.2 Oct 29, 2016
1.7.1 Oct 08, 2016
1.6.2 Sep 04, 2016
1.6.1 Aug 28, 2016
1.6.0 Aug 13, 2016
1.5.6 Jun 18, 2016
1.5.5 Jun 11, 2016
1.5.4 Jun 07, 2016
1.5.3 Apr 03, 2016
1.5.2 Feb 26, 2016
1.5.1 Feb 24, 2016
1.5.0 Jan 28, 2016
1.4.1 Jan 24, 2016
1.4.0 Jan 18, 2016
1.3.2 Nov 27, 2015
1.3.1 Nov 06, 2015
1.3.0 Oct 10, 2015
1.2.1 Aug 27, 2015
1.2.0 Jun 06, 2015
1.1.1 May 25, 2015
1.1.0 May 23, 2015
1.0.1 Apr 14, 2015
1.0.0 Apr 11, 2015
0.9.2 Jan 27, 2015
0.9.1 Dec 05, 2014
0.9.0 Nov 15, 2014
0.8.4 Sep 13, 2014
0.8.3 Aug 16, 2014
0.8.2 Aug 16, 2014
0.8.1 Aug 16, 2014
1.7.3.macosx Nov 23, 2016

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
cryptography (>=39.0)
typing_extensions (>=4.0.0)