最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python一行命令部署http?ftp服務(wù)

 更新時(shí)間:2024年01月17日 08:42:39   作者:zhao138969  
這篇文章主要介紹了Python一行命令部署http?ftp服務(wù)實(shí)現(xiàn)過程詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

Python 一行命令部署http服務(wù)

具體操作命令如下

  • 這個(gè)比nginx相對(duì)來說更加簡(jiǎn)單,可以用于部署特殊場(chǎng)景時(shí)如銀行等部署時(shí),各種權(quán)限控制,內(nèi)網(wǎng)之間可以分發(fā)部署包。
  • 首先進(jìn)入需要訪問下載對(duì)應(yīng)目錄
root@raspberrypi:~ $ cd tmpfile
  • 如果Python版本為2.x,輸入命令
python -m SimpleHTTPServer 80
  • 如果Python版本為3.x,輸入命令
python -m http.server 80

瀏覽器返回下載

  • 瀏覽器下載

  • wget下載
pi@raspberrypi:~ $ wget 10.130.77.55/ZabbixSendApi.tar.gz
--2023-06-25 14:47:15--  http://10.130.77.55/ZabbixSendApi.tar.gz
Connecting to 10.130.77.55:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6018461 (5.7M) [application/gzip]
Saving to: ‘ZabbixSendApi.tar.gz'
ZabbixSendApi.tar.gz                                               
100%[============================================================================================================================>] 5.74M  16.4MB/s    in 0.4s    
2023-06-25 14:47:15 (16.4 MB/s) - ‘ZabbixSendApi.tar.gz' saved [6018461/6018461]

Python 一行命令部署FTP服務(wù)

  • 快速部署FTP 服務(wù)器來臨時(shí)實(shí)現(xiàn)文件上傳下載時(shí),利用 Python 的 Pyftpdlib 模塊可以快速的實(shí)現(xiàn)一個(gè) FTP 服務(wù)器的功能。
  • pyftpdlib安裝
[root@api1 ~]# pip install pyftpdlib
  • pyftpdlib 幫助信息
[root@api1 site-packages]# python -m pyftpdlib --help
Usage: python3 -m pyftpdlib [options]
Start a stand alone anonymous FTP server.
Options:
  -h, --help
     show this help message and exit
  -i ADDRESS, --interface=ADDRESS
     specify the interface to run on (default all interfaces)
  -p PORT, --port=PORT
     specify port number to run on (default 2121)
  -w, --write
     grants write access for logged in user (default read-only)
  -d FOLDER, --directory=FOLDER
     specify the directory to share (default current directory)
  -n ADDRESS, --nat-address=ADDRESS
     the NAT address to use for passive connections
  -r FROM-TO, --range=FROM-TO
     the range of TCP ports to use for passive connections (e.g. -r 8000-9000)
  -D, --debug
     enable DEBUG logging level
  -v, --version
     print pyftpdlib version and exit
  -V, --verbose
     activate a more verbose logging
  -u USERNAME, --username=USERNAME
     specify username to login with (anonymous login will be disabled and password required if supplied)
  -P PASSWORD, --password=PASSWORD
     specify a password to login with (username required to be useful)

ftp案例

使用10001端口,指定/tmp為存儲(chǔ)目錄,使用用戶名admin,密碼Python@123

[root@api1 python  -m pyftpdlib -p 10001 -w -d /tmp/ -u admin -P Python@123
  • 客戶端登錄驗(yàn)證
[root@api1 ~]# ftp 10.130.41.10 10001
Connected to 10.130.41.10 (10.130.41.10).
220 pyftpdlib 1.5.9 ready.
Name (10.130.41.10:root): admin
331 Username ok, send password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls 
227 Entering passive mode (10,130,41,10,167,170).
125 Data connection already open. Transfer starting.
drwxrwxrwt   2 root     root         4096 Sep 17  2021 .ICE-unix
drwxrwxrwt   2 root     root         4096 Sep 17  2021 .Test-unix
drwxrwxrwt   2 root     root         4096 Sep 17  2021 .X11-unix
drwxrwxrwt   2 root     root         4096 Sep 17  2021 .XIM-unix
drwxrwxrwt   2 root     root         4096 Sep 17  2021 .font-unix
-rw-r--r--   1 root     root      2508216 Jan 16 09:14 11.txt
-rw-r--r--   1 root     root     13205746 Jan 16 09:13 1629.pcap
drwxr-xr-x   2 agent    agent        4096 Jan 03 05:40 hsperfdata_agent
drwxr-xr-x   2 portal   portal       4096 Jan 16 08:58 hsperfdata_portal
drwx------   3 root     root         4096 Jan 03 05:34 systemd-private-8fca0ca0813b472a8292a045e324735f-chronyd.service-h16uCI
226 Transfer complete.
ftp> put 11.txt  
local: 11.txt remote: 11.txt
227 Entering passive mode (10,130,41,10,157,167).
125 Data connection already open. Transfer starting.
226 Transfer complete.
2508216 bytes sent in 0.00447 secs (560495.23 Kbytes/sec)

ftp> get  11.txt  
local: 11.txt remote: 11.txt
227 Entering passive mode (10,130,41,10,184,184).
125 Data connection already open. Transfer starting.
226 Transfer complete.
2508216 bytes received in 0.0201 secs (124520.48 Kbytes/sec)
ftp>

以上就是Python 一行命令部署http、ftp服務(wù)的詳細(xì)內(nèi)容,更多關(guān)于Python部署http ftp服務(wù)的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評(píng)論

南溪县| 黔南| 承德县| 合作市| 黄浦区| 喀喇沁旗| 安陆市| 安远县| 沅陵县| 广州市| 资溪县| 金华市| 司法| 西安市| 桂阳县| 信宜市| 昌都县| 武功县| 济源市| 台湾省| 靖远县| 枣阳市| 子洲县| 井陉县| 崇明县| 凤庆县| 双城市| 驻马店市| 安宁市| 同德县| 麟游县| 班戈县| 大方县| 元氏县| 宜君县| 页游| 温泉县| 房山区| 博乐市| 蒙阴县| 岳池县|