FTP配置
下载
# centOS
yum install vsftpd
# unbuntu
apt-get update # 更新软件
apt-get install vsftpd # 安装vsftpd
常见命令
service vsftpd status # 查看状态
service vsftpd restart # 重启
useradd -m -d /home/uftp -s /bin/sh -g root uftp # 添加用户
# -d 配置权限目录
passwd uftp # 设置密码
问题:在查看status时会遇到如下问题,
解决方案:Failed to start vsftpd ftp deamon
FTP 链接
ftp -p 10.19.92.14
# 输入user password
ftp> cd /data
'250 Directory successfully changed.'
ftp> ls
'
227 Entering Passive Mode (10,19,92,14,109,157).
150 Here comes the directory listing.
-rw-r----- 1 0 0 5885328384 Jun 13 02:20 aihead_fm.tar
-rw-r----- 1 0 0 9 Jun 13 07:24 test.txt
226 Directory send OK.
'
ftp> get test.txt # 获取文件
'local: test.txt remote: test.txt
227 Entering Passive Mode (10,19,92,14,245,183).
150 Opening BINARY mode data connection for test.txt (9 bytes).
226 Transfer complete.
9 bytes received in 3.5e-05 secs (257.14 Kbytes/sec)
'
ftp> bye #退出
这里如果ftp遇到[ftp: connect: No route to host]
问题,是防火墙的原因,解决方式如下:
iptables -F # 清除防火墙规则
service iptables save # 保存规则
filezilla 连接
配置如图
这里有需要注意的问题
1.是我这边port没有设置,是默认的21,需要看远程服务器是否21端口开放,否则会遇到Cannot open file xxx for writing
firewall-cmd --permanent --query-port=21/tcp
# no
需要开放
firewall-cmd --permanent --add-port=21/tcp
# Success
firewall-cmd --permanent --query-port=21/tcp
# Yes
可以下载文件了
2. 上传文件显示
Command: STOR tmp.csv Response: 553 Could not create file.
远程服务器文件权限需要修改
usermod --home filepath username
chmod -R 777 filepath
REF:
1. ftp&filezilla: 只有ftp配置部分有效
2. No Route to Host
3. firewall配置启发,但是ufw没起作用
4.533 Error