深入学习ing

linux系统_腾讯云服务器_CentOS_搭建FTP

A-搭建FTP服务器:

1-安装ftp服务器:

yum -y install vsftpd

2-设置ftp开机启动:

systemctl enable vsftpd.service

3-启动ftp服务:

systemctl start vsftpd.service

4-检查ftp服务进程:

netstat -antup | grep ftp

B-FTP服务配置:

# 是否启用匿名(这里设置强制用户登录)
anonymous_enable=NO
# 强制登录用户跳转到指定根目录(配合local_root使用)
local_enable=YES
local_root=/usr/local/wangbobo
# 登录用户是否具有写权限
write_enable=YES

#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
# 限制全部用户固定在根目录
chroot_local_user=YES
# 是否启用限制用户名单
chroot_list_enable=NO
# (default follows)
# chroot_list_file=/etc/vsftpd/chroot_list

# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
# IPV4监控打开
listen=YES
# IPV6注释
# listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=NO
allow_writeable_chroot=YES

C-创建登录用户:

# 添加用户lixh,并设置路径/vsr/local/lixh
useradd -d /vsr/local/lixh lixh

设置用户密码:

passwd lixh

手动修改文件夹所有者为lixh

chown lixh /usr/local/lixh

设置文件权限为755(让用户具备读写,删除,更改等权限):

chomd 755 /usr/local/lixh

D-使用FileZalla客户端测试FTP服务器链接:

我这里使用了云服务器,云服务器注意设置允许21端口穿透防火墙:

 

FileZalla链接配置情况:

 

 这里注意传输设置需要设置为主动模式,否则会报错误:读取目录列表失败

 

 效果图:

E-MAC链接FTP:

在MAC里使用FileZalla链接时可能会出现以下错误:

回应: 200 PORT command successful. Consider using PASV.
指令: LIST
回应: 425 Failed to establish connection.

回应:列表加载失败

可尝试以下解决方案:

编辑FTP服务器端配置文件:vim etc/vsftpd/vsftpd.conf

添加FTP被动访问模式:

# 允许被动模式
pasv_enable=true
pasv_min_port=6000
pasv_max_port=7000

重启FTP服务:

service vsftpd restart

并配置云服务器防火墙放开TCP-6000至7000端口访问:

 

 最后修改FileZalla客户端传输设置为:被动,并重新链接测试。

 

posted on 2022-11-12 02:32  深入学习ing  阅读(118)  评论(0编辑  收藏  举报

导航