Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rspivak/sftpserver
A simple single-threaded SFTP server
https://github.com/rspivak/sftpserver
Last synced: 15 days ago
JSON representation
A simple single-threaded SFTP server
- Host: GitHub
- URL: https://github.com/rspivak/sftpserver
- Owner: rspivak
- Created: 2011-12-12T04:36:01.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2020-09-01T00:52:51.000Z (about 4 years ago)
- Last Synced: 2024-04-29T01:22:31.397Z (7 months ago)
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 138
- Watchers: 12
- Forks: 61
- Open Issues: 10
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
Awesome Lists containing this project
README
sftpserver
==========``sftpserver`` is a simple single-threaded SFTP server based on
Paramiko's SFTPServer.I needed a simple server that could be used as a stub for testing
Python SFTP clients so I whipped out one.Installation
------------Using ``pip``::
$ [sudo] pip install sftpserver
Examples
--------::
$ sftpserver
Usage: sftpserver [options]
-k/--keyfile should be specifiedOptions:
-h, --help show this help message and exit
--host=HOST listen on HOST [default: localhost]
-p PORT, --port=PORT listen on PORT [default: 3373]
-l LEVEL, --level=LEVEL
Debug level: WARNING, INFO, DEBUG [default: INFO]
-k FILE, --keyfile=FILE
Path to private key, for example /tmp/test_rsa.key$ sftpserver -k /tmp/test_rsa.key -l DEBUG
Generating a test private key::
$ openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout /tmp/test_rsa.key
Connecting with a Python client to our server:
>>> import paramiko
>>> pkey = paramiko.RSAKey.from_private_key_file('/tmp/test_rsa.key')
>>> transport = paramiko.Transport(('localhost', 3373))
>>> transport.connect(username='admin', password='admin', pkey=pkey)
>>> sftp = paramiko.SFTPClient.from_transport(transport)
>>> sftp.listdir('.')
['loop.py', 'stub_sftp.py']