linux安装proftpd

Linux下ProFTPD安装指南

安装步骤

1、上传proftpd-1.3.9.tar.gz安装包至/root目录

2、解压

tar -xzvf proftpd-1.3.9.tar.gz

3、切换目录

cd proftpd-1.3.9

4、执行配置命令

./configure --with-modules=mod_quotatab:mod_quotatab_file:mod_ban:mod_tls:mod_rewrite:mod_ifsession --enable-ctrls --enable-nls

执行后结果:

--------------
Build Summary
--------------
Building the following static modules:
  mod_quotatab
  mod_quotatab_file
  mod_ban
  mod_tls
  mod_rewrite
  mod_ctrls
  mod_lang
  mod_ifsession

5、编译

make

执行后如有以下报错,则安装对应包:

make[1]: Entering directory `/root/proftpd-1.3.9/src'
gcc -DHAVE_CONFIG_H  -DLINUX  -I.. -I../include -I../include  -g2 -O2 -Wall -fno-omit-frame-pointer -fno-strict-aliasing -c main.c
main.c:46:31: fatal error: openssl/opensslv.h: No such file or directory
 # include <openssl/opensslv.h>
                               ^
compilation terminated.
make[1]: *** [main.o] Error 1
make[1]: Leaving directory `/root/proftpd-1.3.9/src'
make: *** [src] Error 2

安装openssl-devel
sudo yum install openssl-devel
安装后再执行make编译

make install

6、新增用户

groupadd sunftpgroup
useradd -g sunftpgroup -d /var/ftp -s /bin/bash sunftp
passwd sunftp 123456

7、配置启动文件
cd /etc/init.d/
vi proftpd

#!/bin/sh
#
# Startup script for ProFTPD
#
# chkconfig: 345 85 15
# description: ProFTPD is an enhanced FTP server with \
#              a focus toward simplicity, security, and ease of configuration. \
#              It features a very Apache-like configuration syntax, \
#              and a highly customizable server infrastructure, \
#              including support for multiple 'virtual' FTP servers, \
#              anonymous FTP, and permission-based directory visibility.
# processname: proftpd
# config: /etc/proftpd.conf
#
# By: Osman Elliyasa <osman@Cable.EU.org>
# $Id: proftpd.init.d,v 1.7 2002/12/07 21:50:27 jwm Exp $

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/proftpd ]; then
      . /etc/sysconfig/proftpd
fi

#fix this path by your config, check the "whereis proftpd"

PATH="$PATH:/usr/local/sbin:/var/proftpd/bin:/var/proftpd/sbin"

# See how we were called.
case "$1" in
        start)
                echo -n "Starting proftpd: "
                daemon proftpd $OPTIONS
                echo
                touch /var/lock/subsys/proftpd
                ;;
        stop)
                echo -n "Shutting down proftpd: "
                killproc proftpd
                echo
                rm -f /var/lock/subsys/proftpd
                ;;
        status)
                status proftpd
                ;;
        restart)
                $0 stop
                $0 start
                ;;
        reread)
                echo -n "Re-reading proftpd config: "
                killproc proftpd -HUP
                echo
                ;;
        suspend)
                hash ftpshut >/dev/null 2>&1
                if [ $? = 0 ]; then
                        if [ $# -gt 1 ]; then
                                shift
                                echo -n "Suspending with '$*' "
                                ftpshut $*
                        else
                                echo -n "Suspending NOW "
                                ftpshut now "Maintanance in progress"
                        fi
                else
                        echo -n "No way to suspend "
                fi
                echo
                ;;
        resume)
                if [ -f /etc/shutmsg ]; then
                        echo -n "Allowing sessions again "
                        rm -f /etc/shutmsg
                else
                        echo -n "Was not suspended "
                fi
                echo
                ;;
        *)
                echo -n "Usage: $0 {start|stop|restart|status|reread|resume"
                hash ftpshut
                if [ $? = 1 ]; then
                        echo '}'
                else
                        echo '|suspend}'
                        echo 'suspend accepts additional arguments which are passed to ftpshut(8)'
                fi
                exit 1
esac

if [ $# -gt 1 ]; then
        shift
        $0 $*
fi

exit 0 

修改授权

chmod 755 proftpd

8、启动服务
service proftpd start
service proftpd status

9、修改配置文件proftpd.conf

[root@oracle19c-1 proftpd-1.3.9]# find / -name proftpd.conf
/usr/local/etc/proftpd.conf

vi /usr/local/etc/proftpd.conf

# Set the user and group under which the server will run.
User                            sunftp
Group                           sunftpgroup

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot /var/ftp

<Directory /var/ftp>
        HideNoAccess         off
        <Limit WRITE>
                Order            deny,allow
                AllowUser        sunftp
        </Limit>
</Directory>

修改后重启服务

service proftpd restart

10、测试ftp
若登录失败则修复用户

sudo usermod -s /bin/bash sunftp

测试ftp

ftp 192.168.100.20
连接到 192.168.100.20。
220 ProFTPD Server (ProFTPD Default Installation) [192.168.100.20]
200 UTF8 set to on
用户(192.168.100.20:(none)): sunftp
331 Password required for sunftp
密码:
230 User sunftp logged in
ftp> ls
200 PORT command successful
150 Opening ASCII mode data connection for file list
226 Transfer complete
ftp>
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值