Package: miarec-sshfs
miarec_sshfsSFTP filesystem for PyFilesystem2This is a fork offs.sshfsproject, with modifications that are required for our needs.RequirementsPyFilesystem2sixparamikoproperty-cachedmiarec_sshfssupports Python versions 3.6+Notable differences tofs.sshfsLoading of configuration from SSH Config files (~/.ssh/config) is removed due to potential security issues,
when this component used in SaaS project.Automatic loading of SSH keys from SSH Agent is forbidden due to potential security issues, when this components
is used in SaaS project.The opener protocol prefixes aremssh://andmsftp://(instead of the originalssh://andsftp://)URL is forbidden due to potential leak of SFTP credentials via url.InstallationInstall from GitHub, usingpip:$pipinstallgit+https://github.com/miarec/miarec_sshfs@masterUsageTo connect to an SSH server, use thefs.sshfs.SSHFSconstructor, which signature is:frommiarec_sshfsimportSSHFSmy_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 serveruser: 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: aparamiko.PKeyobject, 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 betweenkeepalivepackets, in seconds.
Set to 0 to disable.compress: set toTrueto 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: aparamiko.MissingHostKeyPolicyinstance, orNoneto useparamiko.AutoAddPolicy.Additional keyword arguments will be passed to the underlyingparamiko.SSHClient.connectcall, taking precedence over implicitly derived arguments. Once created, theSSHFSfilesystem behaves like any
other filesystem (see thePyFilesystem2 documentation).FilesSSHFS.openbinhas 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.TestingAutomated unit tests are run onGitHub ActionsTo run the tests locally, do the following.Install Docker on local machine.Create activate python virtual environment:python -m vevn venv
source venv\bin\activateInstall the project and test dependencies:pip install -e ".[test]"Run tests:pytest -vFeedbackFound a bug ? Have an enhancement request ? Head over to theGitHub
issue trackerof 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.Creditsmiarec_ssfsis developed and maintained byMiaRecOriginal code (fs.sshfs) was developed by:Martin LarraldeThe following people contributed tofs.sshfs:Reimar BauerPaul GessingerMariusz KryńskiWill McGuganJeremy NimmerTim NyborgDanica J. SutherlandJohn VandenbergThis project obviously owes a lot to the PyFilesystem2 project andall its contributors.