CentOS 7下安裝配置proftpd搭建ftp服務器

proftpd全稱:Professional FTP daemon,是針對Wu-FTP的弱項而開發的,除了改進的安全性,還具有許多Wu-FTP沒有的特色,能以Stand-alone、xinetd模式運行等。ProFTP已經成爲繼Wu-FTP以後最爲流行的FTP服務器軟件,愈來愈多的站點選用它構築安全高效的FTP站點,ProFTP配置方便,並有MySQL和Quota模塊可供選擇,利用它們的完美結合能夠實現非系統帳號的管理和用戶磁盤的限制。<摘抄百度百科>html

本章經過下載源碼的方式安裝,能夠到官網下載最新版本:http://www.proftpd.org/linux

一、首先安裝lrzsz方便拷貝文件到要搭建服務器的linux路徑下c++

yum install lrzszcentos

二、上傳文件解壓安全

將下載完成的proftpd-1.3.6.tar.gz文件上傳到指定路徑,使用tar zxvf proftpd-1.3.6.tar.gz解壓bash

三、因爲使用源碼安裝,因此須要安裝gcc編譯環境服務器

yum install gcc gcc-c++ autoconf automakethis

三、配置並制定安裝和配置文件路徑centos7

./configure --prefix=/usr/local/proftpd --sysconfdir=/usr/local/proftpdspa

四、安裝

make&make install

五、修改配置文件,限制匿名用戶能夠上傳下載,可是不能刪除(本章暫不詳細描述權限控制部份內容)

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>

六、關閉防火牆

systemctl stop firewalld.service

systemctl disable firewalld.service

七、啓動服務器

/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  

八、添加到啓動項避免每次重啓後都須要手動啓動

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

相關文章
相關標籤/搜索