搭建基于centos的ftps服务器

搭建ftp服务

1、安装vsftpd服务
输入  rpm -qa | grep vsftpd  检查是否已安装vsftpd服务
在线安装
yum install –y vsftpd
离线安装
下载地址:http://rpmfind.net/linux/rpm2html/search.php?query=vsftpd(x86-64)

rpm -ivh vsftpd-3.0.2-25.el7.x86_64.rpm  安装

pm -qa | grep vsftpd  验证是否安装成功

2、启动vsftpd服务
service vsftpd start

查看21端口   netstat -ntpl | grep 21  验证启动成功

3、ftp配置
 

配置文件路径配置文件内容
/etc/logrotate.d/vsftpd配置日志回滚的文件
/etc/pam.d/vsftpd定义vsftpd是如何认证用户的,默认情况vsftpd支持使用匿名用户和本地用户
/etc/rc.d/init.d/vsftpd服务启动脚本
/etc/vsftpd/vsftpd.conf服务的主配置文件
/usr/sbin/vsftpd服务器端程序
/var/ftpftp的默认家目

修改配置   /etc/vsftpd/vsftpd.conf

anonymous_enable=NO        //禁用匿名用户
chroot_local_user=YES    //打开注释,禁止切换根目录

 其他:
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
禁止/etc/vsftpd/chroot_list目录用户

chroot_local_user=YES
chroot_list_enable=YES
 hroot_list_file=/etc/vsftpd/chroot_list
 不禁止/etc/vsftpd/chroot_list目录用户

 定义匿名用户的最大传输速率,单位为字节:
 anon_max_rate=10240
 限定本地用户最大的下载速度为10KB/s
 local_max_rate=10240
 连接数限定:
 max_clients=100
 max_per_ip=2

4、测试连接

可使用  ftp + ip  测试连接

可能出现登录后 

500 OOPS: chroot  

需要关闭selinux:

(1)使用   setenforce 0  临时关闭

(2)或者修改配置文件

修改 /etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled

重启机器

 

500 OOPS: vsftpd: refusing to run with writable root inside chroot()

从2.3.5之后,vsftpd增强了安全检查,如果用户被限定在了其主目录下,则该用户的主目录不能再具有写权限了!如果检查发现还有写权限,就会报该错误。

(1)去除用户根目录写权限 chmod a-w /home/ftpuser/ ftp用户根目录

(2)或修改vsftpd配置文件,允许写权限

编辑 /etc/vsftpd/vsftpd.conf 文件,增加 allow_writeable_chroot=YES

重启vsftpd服务 service vsftpd restart

(如要上传使用lftp连接)

 

生成证书导入ftp服务中

(可购买或自己生成证书测试)

编辑  /etc/vsftpd/vsftpd.conf ,导入证书后重启ftpd服务

ssl_enable=YES
ssl_tlsv1=YES
ssl_sslv2=YES
ssl_sslv3=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
rsa_cert_file=/etc/vsftpd/ssl/vsftpd.crt
rsa_private_key_file=/etc/vsftpd/ssl/vsftpd.key

重启后可使用FileZilla测试连接

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值