Registry / testing / sftpserver

sftpserver

JSON →
library0.3pypypi✓ verified 80d ago

sftpserver is a simple, single-threaded SFTP server built upon Paramiko's SFTPServer, primarily designed for testing Python SFTP clients rather than production environments. The current version is 0.3, with its last release in April 2017, indicating a maintenance-only status with no active development or new features.

pip install sftpserver
INSTALL
IMPORT
SIG · SFTPSERVER
S
sftpserver
testingpythonv0.3
Install
3.1s avg
Import
814ms
Disk
44MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.846s · 41.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.1s · import 0.782s · 42MB
44MB installed
● package 44MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

start_server
from sftpserver import start_server
import sftpserver
StubSFTPServer
from sftpserver import StubSFTPServer
import sftpserver
StubServer
from sftpserver import StubServer
import sftpserver

This quickstart demonstrates how to start the sftpserver programmatically, generating a temporary RSA key if one doesn't exist. It will listen on 127.0.0.1:3373 by default. Connect with a client using any username/password (e.g., 'admin'/'admin') as the default handler accepts all credentials.

import os import paramiko import sftpserver # Generate a test private key if it doesn't exist key_file = 'test_rsa.key' if not os.path.exists(key_file): print(f"Generating new RSA key for the server: {key_file}") key = paramiko.RSAKey.generate(2048) key.write_private_key_file(key_file) print("Key generated. DO NOT use this key for production.") # Define SFTP server parameters SFTP_HOST = os.environ.get('SFTP_HOST', '127.0.0.1') SFTP_PORT = int(os.environ.get('SFTP_PORT', '3373')) SFTP_KEY_FILE = os.environ.get('SFTP_KEY_FILE', key_file) SFTP_LOG_LEVEL = os.environ.get('SFTP_LOG_LEVEL', 'INFO') print(f"Starting SFTP server on {SFTP_HOST}:{SFTP_PORT}") print(f"Using key file: {SFTP_KEY_FILE}") print(f"Log level: {SFTP_LOG_LEVEL}") print("Connect with username 'admin', password 'admin' (or any credential if no auth callback is set).") print("Press Ctrl+C to stop the server.") try: sftpserver.start_server(SFTP_HOST, SFTP_PORT, SFTP_KEY_FILE, SFTP_LOG_LEVEL) except KeyboardInterrupt: print("\nSFTP server stopped.")
Debug
Known issues
breakingThe library is explicitly stated as 'simple single-threaded' and 'not for production use'. Relying on it for high-traffic or critical production environments will lead to performance bottlenecks and instability.
fix
For production, consider robust SFTP server solutions (e.g., OpenSSH, commercial products) or actively maintained Python libraries like `asyncssh` or `pysftpserver` which offer more features and better concurrency.
affects: <=0.3
gotchaThe server requires a private key file (`-k/--keyfile`) to operate, which must be specified either via command-line arguments or when calling `start_server`. Failure to provide one will result in an error.
fix
Generate an RSA private key using `openssl req -newkey rsa:2048 -nodes -keyout /tmp/test_rsa.key -x509 -days 365 -out /tmp/test_rsa.key.pub` or `paramiko.RSAKey.generate(2048).write_private_key_file(key_path)` and provide its path to the server.
affects: <=0.3
deprecatedGiven the last update in 2017, `sftpserver` likely uses older versions of `paramiko` and may support only outdated SSH/SFTP ciphers and algorithms, which are considered insecure by modern standards.
fix
Avoid using this library for sensitive data. If used for testing, ensure the client explicitly allows older, weaker ciphers/algorithms if connection issues arise, or configure your client to disable strict host key checking for local testing (e.g., `StrictHostKeyChecking no` for `sftp` clients) for ephemeral test servers.
affects: <=0.3
Upgrade
Version history
0.3latest on PyPI · released Apr 9, 2017
Audit
Dependencies
paramikorequiredCore SSH/SFTP client library for server implementation.
Agent activity
23 hits · last 30 days
node
20
OpenAI (training)
1
Resources
sftpserver — pip install sftpserver · libregistry