1.FTP介绍
FTP(File Transfer Protocol)是一种用于在计算机之间传输文件的标准网络协议。FTP协议在TCP/IP协议族中属于应用层协议,通过它可以将文件从一台计算机传输到另一台计算机。FTP协议提供了两种工作模式:标准模式和被动模式。在标准模式下,客户端通过控制连接建立与服务器的连接,并通过数据连接进行数据传输。在被动模式下,客户端发出PASV命令,服务器返回一个端口号,客户端通过端口号与服务器建立数据连接,进行数据传输。FTP协议通常用于网站维护、文件共享和软件下载等方面。
2.FTP使用到的端口
FTP的正常工作需要使用到多个网络端口:
命令通道,默认端口为21
数据通道, 默认端口为20
3.vsftpd介绍
vsftpd是一个开源的FTP服务器软件,它是“非常安全的FTP守护进程”的缩写。它具有快速、安全、高效的特点,支持IPv6、SSL、TLS加密协议,可以大幅度地提高FTP服务器的安全性。vsftpd软件具有安装方便、性能可靠、系统资源占用低等特点,广泛应用于各种服务器环境。由于其安全性和性能方面的优势,vsftpd已成为Linux服务器上常见的FTP服务器软件之一。
3.1安装管理vsftpd服务
1.安装vsftpd
dnf install vsftpd
2.启动查看状态
1.启动
systemctl start vsftpd
2.查看状态
systemctl status vsftpd
3.停止
systemctl stop vsftpd
4.重启
systemctl restart vsftpd
3.vsftpd配置文件修改
在euler系统中,默认不开匿名用户,vim命令配置文件
[root@ljy ~]# vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
设置vsftpd时间为本地时间操作:
1.打开文件vsftpd.conf ,将参数use_localtime的参数值为YES
vim /etc/vsftpd/vsfrtpd.conf
use_locatime=YES
修改完成后,重启服务
设置开机自启
systemctl enable vsftpd
配置系统账号登录权限:
如果用户需要限制系统帐号登录,需要在root权限下将对应帐号添加到/etc/vsftpd/ftpusers和/etc/vsftpd/user_list。
[root@ljy ~]# cat /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
验证FTP服务是否搭建成功
[root@ljy ~]# ftp localhost
Trying ::1...
Connected to localhost (::1).
220- FTP server!
220
Name (localhost:root): ftp
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
ftp>
没有ftp命令,可以在root权限下执行 dnf install ftp 安装
配置防火墙
# firewall-cmd --add-service=ftp --permanent
success
# firewall-cmd --reload
success
# setsebool -P ftpd_full_access on