Shuo
Shuo I'm a DBA(Database Administrator), we can share and discuss MySQL, MongoDB, Redis and other databases here, also including learning Python, Shell, Golang together.

Create a ftp-server using Python


在运维过程中,需要传输文件的时候,可以使用python命令,直接开启一个ftp服务的进程,网络通即可直接传输文件。

在源端机器上

进入到需要传输的文件的目录下,执行:

1
2
3
4
5
[python2]
python -m SimpleHTTPServer 8081

[python3]
python -m http.server 8081

其中8081为自定义的端口,可进行修改。

在目标端

(1)浏览器访问 localhost:8081

(2)可以直接使用wget命令:

1
wget "http://源端ip:8081/文件名"

comments powered by Disqus