Pyfilesystem2 over SSH using paramiko
Project description
Requirements
pyfilesystem2 |
|||
six |
|||
paramiko |
|||
property-cached |
Installation
Install directly from PyPI, using pip
pip install 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. The following URL parameters are supported: timeout, keepalive.
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 connection 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.
See also
fs, the core pyfilesystem2 library
fs.archive, enhanced archive filesystems for pyfilesystem2
fs.smbfs, Pyfilesystem2 over SMB using pysmb
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fs.sshfs-0.13.1.tar.gz
.
File metadata
- Download URL: fs.sshfs-0.13.1.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65f6824b8b22fe5d131f53dd3029be490ec66f85d88291b915dcd058cd188b99 |
|
MD5 | a6b4bbeb90f5a9f568cfd4e3e906d661 |
|
BLAKE2b-256 | 24518104cffa082f2aed56af1a17e7d00377c09a00ceb07ee4e81a1e28cb6732 |
Provenance
File details
Details for the file fs.sshfs-0.13.1-py2.py3-none-any.whl
.
File metadata
- Download URL: fs.sshfs-0.13.1-py2.py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 947c476c9e889ee8d86fb68d9cafcc01b9e7d1d2f60a760202b1c2602433ea33 |
|
MD5 | 96dfe3f40e012566c6d89a572ae8e98a |
|
BLAKE2b-256 | bbb28a31e39cee941920caaf4c81d120391fa21c354e48f18f7cd1fb71e36420 |