Skip to main content

sshfs

sshfs is an implementation of fsspec for the SFTP protocol using asyncssh.

Features

  • A complete implementation of the fsspec protocol through SFTP
  • Supports features outside of the SFTP (e.g server side copy through SSH command execution)
  • Quite fast (compared to alternatives like paramiko)
  • Builtin Channel Management
  • Async! (thanks to asyncssh)

Tutorial

Install the sshfs from PyPI or the conda-forge. This will install fsspec and register sshfs for ssh:// urls, so you can open files using:

from fsspec import open

with open('ssh://[user@]host[:port]/path/to/file', "w") as file:
    file.write("Hello World!")

with open('ssh://[user@]host[:port]/path/to/file', "r") as file:
    print(file.read())

For more operations, you can use the SSHFileSystem class directly:

from sshfs import SSHFileSystem

To connect with a password, you can simply specify username/password as keyword arguments and connect to the host of your choosing;

# Connect with a password
fs = SSHFileSystem(
    '127.0.0.1',
    username='sam',
    password='fishing'
)

If you want to use a private key to authenticate, you can either pass a string pointing to the path of the key, or give a list of them to be tried:

# or with a private key
fs = SSHFileSystem(
    'ssh.example.com',
    client_keys=['/path/to/ssh/key']
)

Note: you can also pass client_keys as an argument to fsspec.open.

All operations and their descriptions are specified here. Here are a few example calls you can make, starting with info() which allows you to retrieve the metadata about given path;

>>> details = fs.info('/tmp')
>>> print(f'{details["name"]!r} is a {details["type"]}!')
'/tmp/' is a directory!
>>>
>>> crontab = fs.info('/etc/crontab')
>>> print(f'{crontab["name"]!r} is a {crontab["type"]}!')
'/etc/crontab' is a file!

You can also create new files through either putting a local file with put_file or opening a file in write mode;

>>> with fs.open('/tmp/message.dat', 'wb') as stream:
...     stream.write(b'super secret message!')
...

And either download it through get_file or simply read it on the fly with opening it;

>>> with fs.open('/tmp/message.dat') as stream:
...     print(stream.read())
...
b'super secret message!'

There are also a lot of other basic filesystem operations, such as mkdir, touch and find;

>>> fs.mkdir('/tmp/dir')
>>> fs.mkdir('/tmp/dir/eggs')
>>> fs.touch('/tmp/dir/spam')
>>> fs.touch('/tmp/dir/eggs/quux')
>>>
>>> for file in fs.find('/tmp/dir'):
...     print(file)
...
/tmp/dir/eggs/quux
/tmp/dir/spam

If you want to list a directory but not it's children, you can use ls();

>>> [(detail['name'], detail['type']) for detail in fs.ls('/tmp/dir', detail=True)]
[('/tmp/dir/spam', 'file'), ('/tmp/dir/eggs', 'directory')]

Metadata

Release files for sshfs 2026.11.0

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

Source distribution (sdist)

Source distribution for sshfs 2026.11.0
File Size Uploaded Provenance Actions
sshfs-2026.11.0.tar.gz 28.8 kB Without provenance Details for sshfs-2026.11.0.tar.gz

Built distribution (wheel)

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

Total release size: 46.2 kB

Release files / sshfs-2026.11.0.tar.gz

Download URL sshfs-2026.11.0.tar.gz
Size 28.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8229abfa131948fc11f0a75780a4e906b80d37dcefa5e1564d78e94d73d0e93a
BLAKE2b-256 checksum
How to use checksums
5d057870e1045dd246045b182f86427dd15be834ca7853e5acc8f375ff155873
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / sshfs-2026.11.0-py3-none-any.whl

Download URL sshfs-2026.11.0-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9d4f83344caef12bf7f18ecd4d09191c60fb01f5816c064c5c2756e933b2b21
BLAKE2b-256 checksum
How to use checksums
20c0399ab2a74cffb06c8996c5bf8cebb14426bc45cc731347d6ccb85ccec112
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for sshfs 2026.11.0

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2026.11.0 This release

2 release files No provenance

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