Skip to main content

sftpd

A simple multi-thread sftp server.

Install

pip install sftpd

Usage

C:\workspace\sftpd>sftpd --help
Usage: sftpd [OPTIONS] COMMAND [ARGS]...

Options:
-c, --config FILENAME  Config file path, use yaml format.
--help                 Show this message and exit.

Commands:
reload  Reload application server.
start   Start application server.
stop    Stop application server.

##Example start

D:\sftpd>dir

D:\sftpd 

2018/05/18  20:51    <DIR>          .
2018/05/18  20:51    <DIR>          ..
2018/05/18  20:39             1,036 sftpd.yml
2018/05/18  20:06                36 users.yml
            2 files          1,072 bytes
            2 folders 289,594,834,944 bytes

e:\sftpd>sftpd start
2018-05-18 20:39:30,548 DEBUG   sftp server starting with config = {'application': {'daemon': False, 'main': 'sftpd.server.sftp_server'}, 'server': {'binding': '0.0.0.0', 'port': 2222, 'backlog': 32}, 'sftpd': {'root': 'e:/sftpd', 'keyfile': '~/.ssh/id_rsa', 'users': 'users.yml'}, 'logging': {'version': 1, 'disable_existing_loggers': False, 'formatters': {'simple': {'format': '%(asctime)-15s\t%(levelname)s\t%(message)s'}}, 'handlers': {'console': {'class': 'logging.StreamHandler', 'level': 'DEBUG', 'formatter': 'simple'}, 'file': {'class': 'logging.handlers.TimedRotatingFileHandler', 'level': 'DEBUG', 'formatter': 'simple', 'filename': 'server.log', 'backupCount': 30, 'when': 'D', 'interval': 1, 'encoding': 'utf-8'}}, 'loggers': {'sftpd': {'level': 'DEBUG', 'handlers': ['file', 'console'], 'propagate': False}}, 'root': {'level': 'DEBUG', 'handlers': ['file', 'console']}}}.
2018-05-18 20:39:30,548 DEBUG   sftp server start socket listening: binding=0.0.0.0, port=2222, backlog=32.
2018-05-18 20:39:30,564 DEBUG   sftp server wating connection...

Example config

application:
    daemon: true
    pidfile: sftpd.pid

server:
    binding: 0.0.0.0
    port: 2222
    backlog: 32

sftpd:
    root: e:/sftpd
    keyfile: ~/.ssh/id_rsa
    users: users.yml

logging:
    version: 1
    disable_existing_loggers: false
    formatters:
        simple:
            format: "%(asctime)-15s\t%(levelname)s\t%(message)s"
    handlers:
        console:
            class: logging.StreamHandler
            level: DEBUG
            formatter: simple
        file:
            class: logging.handlers.TimedRotatingFileHandler
            level: DEBUG
            formatter: simple
            filename: server.log
            backupCount: 30
            when: D
            interval: 1
            encoding: utf-8
    loggers:
        sftpd:
            level: DEBUG
            handlers:
                - file
                - console
            propagate: no
    root:
        level: DEBUG
        handlers:
            - file
            - console

Note:

  1. sftpd.root defaults to os.getcwd().
  2. sftpd.keyfile defaults to ~/.ssh/id_rsa.
  3. You can use ssh-keygen to generate server key.
  4. sftpd.users defaults to users.yml, it is yaml format config file contains users and users' password.

Example users

user01:
    password: user01's-password
user02:
    password: user02's-password

Note:

  1. sftpd will always reload data from users.yml while doing authentication.

Releases

v0.1.0 2018/03/18

  • First release.

v0.1.1 2018/03/18

v0.1.2 2018/03/21

  • Update.

v0.2.0 2022/01/08

  • Fix license file missing problem.

Release files for sftpd 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sftpd 0.2.0
File Size Uploaded
sftpd-0.2.0.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sftpd 0.2.0
File Interpreter ABI Platform
sftpd-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.8 kB

Release files / sftpd-0.2.0.tar.gz

Download URL sftpd-0.2.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ab013c00ba21a6e10677a44922da2819653bc6db4ca24080b81c00bd9b539a96
BLAKE2b-256 checksum
How to use checksums
f7bc2ae3dce6651054a7265d745be2155c5f577e749c7944179a7ac9aa5accc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / sftpd-0.2.0-py3-none-any.whl

Download URL sftpd-0.2.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0097bf3f0e058e987a5b7b00304f802827c130540f81f67c734bd86395dea8b
BLAKE2b-256 checksum
How to use checksums
ce0f04d3260944d9959894daeec92a93ee6d5ae07794a21d8916aa529286d531
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page