Skip to content
master
Switch branches/tags
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

sshfs

sshfs is a filesystem interface for SSH/SFTP. It is based on top of asyncssh and implements the fsspec protocol.

Features

  • Supports filesystem operations outside of SFTP, e.g server side copy
  • Auto SFTP channel management
  • Async! (thanks to asyncssh)

Example

from sshfs import SSHFileSystem


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

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

details = fs.info('/tmp')
print(f'{details['name']} is a {details['type']}!')


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

with fs.open('/tmp/message.dat') as stream:
    print(stream.read())


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)

About

sshfs - SSH/SFTP implementation for fsspec

Resources

License

Packages

No packages published

Languages