python中的单线ftp服务器

2022-01-09 00:00:00 python ftp ftp-server

问题描述

是否可以在 python 中使用一行命令来做一个简单的 ftp 服务器?我希望能够以快速和临时的方式将文件传输到 linux 机器,而无需安装 ftp 服务器.最好是使用内置 python 库的方法,因此无需安装任何额外内容.

Is it possible to have a one line command in python to do a simple ftp server? I'd like to be able to do this as quick and temporary way to transfer files to a linux box without having to install a ftp server. Preferably a way using built in python libraries so there's nothing extra to install.


解决方案

强制 Twisted 示例:

twistd -n ftp

而且可能有用:

twistd ftp --help

Usage: twistd [options] ftp [options].
WARNING: This FTP server is probably INSECURE do not use it.
Options:
  -p, --port=           set the port number [default: 2121]
  -r, --root=           define the root of the ftp-site. [default:
                    /usr/local/ftp]
  --userAnonymous=  Name of the anonymous user. [default: anonymous]
  --password-file=  username:password-style credentials database
  --version         
  --help            Display this help and exit.

相关文章