目录
工作需要在一个新服务器上搭建ftp服务,以便文件上传下载。
一、安装并配置ftp及vsftpd
1. 安装ftp和vsftpd
首先通过yum安装ftp和vsftpd。
yum install ftp vsftpd
2. 修改vsftpd配置文件
vim /etc/vsftpd/vsftpd.conf
# ASCII 及欢迎消息
# ASCII mangling is a horrible feature of the protocol.
ascii_upload_enable=YES
ascii_download_enable=YES
# You may fully customise the login banner string:
ftpd_banner=Welcome to xxxxx FTP service.
# 最后一行
use_localtime=YES
3. 启动服务
systemctl enable vsftpd
systemctl start vsftpd
4. 修改防火墙配置
firewall-cmd --permanent --add-port=21/tcp
firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload
5. 修改SElinux策略
setsebool -P ftp_home_dir on
6. 增加ftp用户用于登录(默认禁用root)
由于使用ftp登录时默认禁用root用户,因此创建新用户为ftp登录使用。
useradd ftpuser
passwd ftpuser # 修改密码
二、PC端连接并登录
windows cmd 测试
ftp IP
ftp> exit
FileZilla连接并登录
端口20,21
三、参考文献
一篇文章了解开源 FTP 服务器 vsftpd
Linux启动ftp服务器530 Permission denied解决方法