在centos7下搭建ftp server

发布时间 2023-11-30 09:35:10作者: 正在努力的BOY

1、安装软件

yum install vsftpd

2、修改配置文件

目的:

  1)将使用系统本地用户登陆

  2)将用户锁定在其家目录下,不能随意切换

  3)禁用匿名用户

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
chroot_local_user=YES
chroot_list_enable=YES
allow_writeable_chroot=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pam_service_name=vsftpd
userlist_enable=NO
tcp_wrappers=YES

默认/etc/vsftpd/chroot_list文件不存在,需要创建

ls /etc/vsftpd/chroot_list
touch /etc/vsftpd/chroot_list

3、启动vsftpd服务

systemctl start vsftpd
systemctl enable vsftpd

4、安装ftp客户端并测试登陆

yum install ftp
useradd cs1
passwd cs1
ftp 127.0.0.1