Skip to main content

Pyfilesystem2 over SSH using paramiko

Project description

fs.sshfs star me

Source PyPI Conda Actions Codecov Codacy License Versions Format GitHub issues Downloads Changelog

Requirements

PyFilesystem2 PyPI fs Source fs License fs
six PyPI six Source six License six
paramiko PyPI paramiko Source paramiko License paramiko
property-cached PyPI property Source property License property

fs.sshfs supports all Python versions supported by PyFilesystem2: Python 2.7, and Python 3.5 onwards. Code should still be compatible with Python 3.4, but not tested anymore.

Installation

Install directly from PyPI, using pip:

$ pip install fs.sshfs

There is also a conda-forge package available:

$ conda install -c conda-forge fs.sshfs

Usage

Opener

Use fs.open_fs to open a filesystem with an SSH FS URL:

import fs
my_fs = fs.open_fs("ssh://[user[:password]@]host[:port]/[directory]")

The sftp scheme can be used as an alias for the ssh scheme in the FS URL. Additional argument can be passed to the SSHFS constructor as percent-encoded URL parameters (excepted policy). See section below for a list of all supported arguments.

Constructor

For a more granular way of connecting to an SSH server, use the fs.sshfs.SSHFS constructor, which signature is:

from fs.sshfs import SSHFS
my_fs = SSHFS(
  host, user=None, passwd=None, pkey=None, timeout=10, port=22,
  keepalive=10, compress=False, config_path='~/.ssh/config'
)

with each argument explained below:

  • host: the name or IP address of the SSH server
  • user: the username to connect with, defaults to the current user.
  • passwd: an optional password, used to connect directly to the server or to decrypt the public key, if any given.
  • pkey: a paramiko.PKey object, a path, or a list of paths to an SSH key.
  • timeout: the timeout, in seconds, for networking operations.
  • port: the port the SSH server is listening on.
  • keepalive: the interval of time between keepalive packets, in seconds. Set to 0 to disable.
  • compress: set to True to compress the communications with the server.
  • config_path: the path to an OpenSSH configuration file.
  • exec_timeout: the timeout, in seconds, for arbitrary SSH commands on the server.
  • policy: a paramiko.MissingHostKeyPolicy instance, or None to use paramiko.AutoAddPolicy.

Additional keyword arguments will be passed to the underlying paramiko.SSHClient.connect call, taking precedence over implicitly derived arguments. Once created, the SSHFS filesystem behaves like any other filesystem (see the PyFilesystem2 documentation).

Files

SSHFS.openbin has the following extra options that can be passed as keyword arguments to control the file buffering:

  • prefetch: enabled by default, use a background thread to prefetch the content of a file opened in reading mode. Does nothing for files in writing mode.
  • pipelined: enable pipelined mode, avoid waiting for server answer between two uploaded chunks. Does nothing for files in reading mode.

Configuration

SSHFS are aware of SSH config files and as such, one of the hosts in the configuration file can be provided as the host argument for the filesystem to connect to the server with the proper configuration values.

Feedback

Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker of the project if you need to report or ask something. If you are filling in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproductible situation.

Credits

fs.sshfs is developped and maintainted by:

The following people contributed to fs.sshfs:

This project obviously owes a lot to the PyFilesystem2 project and all its contributors.

See also

  • fs, the core PyFilesystem2 library
  • fs.archive, enhanced archive filesystems for PyFilesystem2
  • fs.smbfs, PyFilesystem2 over SMB using pysmb

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

fs.sshfs-1.0.1.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

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

fs.sshfs-1.0.1-py2.py3-none-any.whl (24.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file fs.sshfs-1.0.1.tar.gz.

File metadata

  • Download URL: fs.sshfs-1.0.1.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for fs.sshfs-1.0.1.tar.gz
Algorithm Hash digest
SHA256 05cb3dac1a932d5c4f44d1c2a43963ae5ff13450af1d6fb9ee6ce0139754ed1a
MD5 85da54044db7d25e92de76e307d45285
BLAKE2b-256 9d8a4ea94bdb4d12229ae118e65c90a1e79116b01970cb021dfc073790855581

See more details on using hashes here.

File details

Details for the file fs.sshfs-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: fs.sshfs-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for fs.sshfs-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f9f30a027b6c93bada0527d0a8d8440c2222cf5f3ba2a481138a99c8e572636b
MD5 b1760deb77219c3def2f6e6a880c296c
BLAKE2b-256 4c76a1248c316ee73b1a43654f000ac84298bc409fba1c0f00494a121acf441b

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