CentOS 7下安装配置proftpd搭建ftp服务器的详细教程
程序员文章站
2022-07-09 16:35:14
proftpd全称:professional ftp daemon,是针对wu-ftp的弱项而开发的,除了改进的安全性,还具备许多wu-ftp没有的特点,能以stand-alone、xinetd模式运...
proftpd全称:professional ftp daemon,是针对wu-ftp的弱项而开发的,除了改进的安全性,还具备许多wu-ftp没有的特点,能以stand-alone、xinetd模式运行等。proftp已经成为继wu-ftp之后最为流行的ftp服务器软件,越来越多的站点选用它构筑安全高效的ftp站点,proftp配置方便,并有mysql和quota模块可供选择,利用它们的完美结合可以实现非系统账号的管理和用户磁盘的限制。<摘抄百度百科>
本章通过下载源码的方式安装,可以到官网下载最新版本:http://www.proftpd.org/
1、首先安装lrzsz方便拷贝文件到要搭建服务器的linux路径下
yum install lrzsz
2、上传文件解压
将下载完成的proftpd-1.3.6.tar.gz文件上传到指定路径,使用tar zxvf proftpd-1.3.6.tar.gz解压
3、由于使用源码安装,所以需要安装gcc编译环境
yum install gcc gcc-c++ autoconf automake
3、配置并制定安装和配置文件路径
./configure --prefix=/usr/local/proftpd --sysconfdir=/usr/local/proftpd
4、安装
make&make install
5、修改配置文件,限制匿名用户可以上传下载,但是不能删除(本章暂不详细描述权限控制部分内容)
vi /usr/local/proftpd/proftpd.conf # this is a basic proftpd configuration file (rename it to # 'proftpd.conf' for actual use. it establishes a single server # and a single anonymous login. it assumes that you have a user/group # "nobody" and "ftp" for normal operation and anon. servername "welcome to ftp server" servertype standalone defaultserver on # port 21 is the standard ftp port. port 21 # don't use ipv6 support by default. useipv6 off # umask 022 is a good standard umask to prevent new dirs and files # from being group and world writable. umask 022 # to prevent dos attacks, set the maximum number of child processes # to 30. if you need to allow more than 30 concurrent connections # at once, simply increase this value. note that this only works # in standalone mode, in inetd mode you should use an inetd server # that allows you to limit maximum number of processes per service # (such as xinetd). maxinstances 30 # set the user and group under which the server will run. user nobody group nobody # to cause every ftp user to be "jailed" (chrooted) into their home # directory, uncomment this line. #defaultroot ~ # normally, we want files to be overwriteable. allowoverwrite on identlookups off usereversedns off # bar use of site chmod by default <limit site_chmod> allowall </limit> # a basic anonymous configuration, no upload directories. if you do not # want anonymous users, simply delete this entire <anonymous> section. <anonymous /home> user ftp group ftp # we want clients to be able to login with "anonymous" as well as "ftp" useralias anonymous ftp # limit the maximum number of anonymous logins maxclients 50 # we want 'welcome.msg' displayed at login, and '.message' displayed # in each newly chdired directory. displaylogin welcome.msg displaychdir .message # limit write everywhere in the anonymous chroot <limit dele rmd> denyall </limit> </anonymous>
6、关闭防火墙
systemctl stop firewalld.service systemctl disable firewalld.service
7、启动服务器
/usr/local/proftpd/sbin/proftpd
查看进程是否已经启动
[root@localhost ~]# ps -ef |grep proftpd nobody 1140 1 0 12:13 ? 00:00:00 proftpd: (accepting connections) root 3182 2270 0 12:50 pts/0 00:00:00 grep --color=auto proftpd
8、添加到启动项避免每次重启后都需要手动启动
vi /etc/rc.d/rc.local #!/bin/bash # this file is added for compatibility purposes # # it is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # in contrast to previous versions due to parallel execution during boot # this script will not be run after all other services. # # please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. touch /var/lock/subsys/local /usr/local/proftpd/sbin/proftpd
由于在centos7中/etc/rc.d/rc.local的权限被降低了,所以需要加上可执行的权限:
chmod +x /etc/rc.d/rc.local
总结
以上所述是小编给大家介绍的centos 7下安装配置proftpd搭建ftp服务器的详细教程,希望对大家有所帮助