一、linux

1、关闭防火墙

[root@client ~]# systemctl stop firewalld
[root@client ~]# systemctl disable firewalld
[root@client ~]# systemctl disable firewalld
[root@client ~]# systemctl status firewalld 
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Mar 26 06:38:19 client systemd[1]: Starting firewalld - dynamic firewall daemon...
Mar 26 06:38:19 client systemd[1]: Started firewalld - dynamic firewall daemon.
Mar 27 05:00:27 client systemd[1]: Stopping firewalld - dynamic firewall daemon...
Mar 27 05:00:28 client systemd[1]: Stopped firewalld - dynamic firewall daemon

 

2、进入需要共享文件的目录,执行如下命令,这个端口号可以任意指定没有被占用的端口

python2

python -m SimpleHTTPServer 9110

 

python3

python -m http.Server 9110

 

[root@client ~]# python -m SimpleHTTPServer 9110
Serving HTTP on 0.0.0.0 port 9110 ...
200.200.210.89 - - [27/Mar/2019 05:00:40] "GET / HTTP/1.1" 200 -
200.200.210.89 - - [27/Mar/2019 05:00:41] code 404, message File not found
200.200.210.89 - - [27/Mar/2019 05:00:41] "GET /favicon.ico HTTP/1.1" 404 -

 

3、通过浏览器访问即可,就可以下载文件

http://10.58.55.14:9110/

 

二、windows

1、首先进入需要共享的目录

2、在地址栏输入cmd,打开windows的命令窗口

3、在命令窗口中输入python -m http.server 8083

这里python2使用python2的命令,python3使用python3的命令

python -m http.server 8083

 

4、通过浏览器访问即可

http://10.87.6.1:8083/

 5、点击文件即可下载

 

posted on 2019-03-27 09:09  bainianminguo  阅读(307)  评论(0编辑  收藏  举报