vsftp被动模式nginx代理

vsftp被动模式nginx代理

  • vsftp配置,添加如下配置项
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
pasv_enable=YES
pasv_min_port=30000
pasv_max_port=30001
pasv_address=10.8.8.207
port_enable=YES
connect_from_port_20=YES

xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
dual_log_enable=YES
log_ftp_protocol=YES
  • 在创建一个ftp用户即可

  • nginx代理配置项

stream {
    upstream ftp_command {
        server  10.8.8.9:21 max_fails=1 fail_timeout=10s;
   }

    upstream ftp_data1 {
        server  10.8.8.9:30000 max_fails=1 fail_timeout=10s;
   }
    upstream ftp_data2 {
        server  10.8.8.9:30001 max_fails=1 fail_timeout=10s;
   }
   server {
   listen 21;
   proxy_pass ftp_command;
   }
   server {
   listen 30000;
   proxy_pass ftp_data1;
   }
   server {
   listen 30001;
   proxy_pass ftp_data2;
   }
}
  • 验证
[root@volte-uat2 offcial]# ftp 10.8.8.9
Connected to 10.8.8.9 (10.8.8.9).
220 (vsFTPd 3.0.2)
Name (10.8.8.9:root): test
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (0,0,0,0,117,49).
150 Here comes the directory listing.
-rw-r--r--    1 1007     1007           32 Sep 24 06:46 FxhOHCnvx8.txt
-rw-r--r--    1 1007     1007         3857 Sep 24 06:46 index.html
-rw-r--r--    1 1007     1007       548444 Sep 24 06:39 libshout.tar.gz
-rw-r--r--    1 0        0            1475 Sep 24 06:39 passwd
226 Directory send OK.
ftp> 
ftp> 
200.html             aos/                 common/              FxhOHCnvx8.txt       imgs-forgotpassword/ imgs-v2.1/           index.html_bakqnt8   qncc/                svg/                 
agent/               client/              config.js            highlight.min.css    imgs-platform/       imgs-v2.2/           media/               sdk/                 vpm/                 
agent_sdk/           client_sdk/          favicon.ico          imgs-entrance/       imgs-site/           index.html           _nuxt/               statics/             
ftp> put    index.html    
local: index.html remote: index.html
227 Entering Passive Mode (0,0,0,0,117,48).
150 Ok to send data.
226 Transfer complete.
3857 bytes sent in 4.8e-05 secs (80354.16 Kbytes/sec)
ftp> ls
227 Entering Passive Mode (0,0,0,0,117,49).
150 Here comes the directory listing.
-rw-r--r--    1 1007     1007           32 Sep 24 06:46 FxhOHCnvx8.txt
-rw-r--r--    1 1007     1007         3857 Sep 24 07:05 index.html
-rw-r--r--    1 1007     1007       548444 Sep 24 06:39 libshout.tar.gz
-rw-r--r--    1 0        0            1475 Sep 24 06:39 passwd
226 Directory send OK.
ftp> get  libshout.tar.gz
local: libshout.tar.gz remote: libshout.tar.gz
227 Entering Passive Mode (0,0,0,0,117,49).
150 Opening BINARY mode data connection for libshout.tar.gz (548444 bytes).
226 Transfer complete.
548444 bytes received in 0.0116 secs (47340.87 Kbytes/sec)

本文由 mdnice 多平台发布

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

平凡的运维之路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值