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)
远程挂载ftp
- 远程挂载ftp
yum -y install curlftpfs
curlftpfs -o allow_other ftp://test:uH4C_Lsk@10.8.8.9 /test1
[root@volte-uat2 test1]# cd /test1/
[root@volte-uat2 test1]# ls -trl
total 6760
-rw-r--r-- 1 root root 1475 Sep 24 06:39 passwd
-rw-r--r-- 1 root root 548444 Sep 24 06:39 libshout.tar.gz
-rw-r--r-- 1 root root 32 Sep 24 06:46 FxhOHCnvx8.txt
-rw-r--r-- 1 root root 3857 Sep 24 07:05 index.html
-rw-r--r-- 1 root root 6357966 Sep 24 08:37 nginx.tar.gz
[root@volte-uat2 test1]# df -h
Filesystem Size Used Avail Use% Mounted /sys/fs/cgroup
/dev/vda1 40G 3.5G 37G 9% /
curlftpfs#ftp://test:uH4C_Lsk@10.8.8.9/ 954G 0 954G 0% /test1
评论区