当前位置:首页 > 嵌入式 > 嵌入式软件
[导读]与非网(EEFOCUS)电子产业社区平台为中国电子行业首家采用强大技术平台,由专业的电子技术编辑服务,为全球3000家知名半导体厂家及电子技术系统厂商提供技术信息发布、厂商网站、技术社区建设服务,并以电子术语词典,集成电路数据手册查询,电子产品新闻访谈资讯信息以及互动技术交流社区为上百万电子技术工程师以及高校师生提供最完整的电子技术信息查询和交流服务。

作者:llzqq
联系:llzqq@126.com
来自:www.chinaunix.net

在众多的FTP服务器中PROFTPD由于它的配置灵活,安装简便。近年来一直受到人们的喜爱。通常情况下FTP包括认证过程,传输是明文传输的,在传输一些敏感数据时总是不能让人放心。今天我在网上找了一些零散的资料结合自己的实作写了个帖子贡献给大家。

下载最新的软件版本:

# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.0rc3.tar.gz

首先创建ROFTPD运行的用户和组:

# groupadd nogroup
# useradd –g nogroup –d /dev/null –s /sbin/nologin nobody

首先创建上传下载的用户和组:

# groupadd ftp
# useradd –g ftp –d /home/down –s /sbin/nologin down
# useradd –g ftp –d /home/upload –s /sbin/nologin upload
用户密码设置略

编译安装PROFRPD:

# tar –zxvf proftpd-1.3.0rc3.tar.gz
# cd proftpd-1.3.0rc3
# ./configure
--prefix=/usr/local/proftpd
--sysconfdir=/etc
--enable-autoshadow
--localstatedir=/var/run
--enable-ctrls
--with-modules=mod_tls

# make
# make install

配置PROFTPD服务器:

# vi /etc/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 "llzqq"
ServerType standalone
DefaultServer on
AllowRetrieveRestart on
AllowStoreRestart on
ServerType standalone
ServerIdent on
SystemLog /var/log/proftpd.log
UseReverseDNS off
IdentLookups off
RequireValidShell off
# Port 21 is the standard FTP port.
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
MaxInstances 100
# Set the user and group under which the server will run.
User nobody
Group nogroup
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
# Normally, we want files to be overwriteable.
<Directory />
AllowOverwrite on
</Directory>
# We want ‘welcome.msg‘ displayed at login, and ‘.message‘ displayed
# in each newly chdired directory.
DisplayLogin .welcome
DisplayFirstChdir .message
# Limit User of being enbled login ftp server
<Limit LOGIN>
AllowGroup ftp
DenyAll
</Limit>
#########################ssl/tls############################
# MOD_TLS SETTING
<IfModule mod_tls.c>
TLSEngine on
TLSLog /var/log/proftpd-tls.log
TLSProtocol SSLv23
# Are clients required to use FTP over TLS when talking to this server?
TLSRequired ctrl
# Server‘s certificate
TLSRSACertificateFile /etc/proftpd.crt
TLSRSACertificateKeyFile /etc/proftpd.key
# Authenticate clients that want to use FTP over TLS
TLSVerifyClient off
#########################ssl/tls############################
<Directory /home/down>
<Limit WRITE>
DenyGroup ftp
</Limit>
TransferRate RETR 150 group ftp
</Directory>
<Directory /home/upload>
<Limit RMD RNFR DELE RETR>
DenyGroup ftp
</Limit>
TransferRate STOR 150 group ftp
</Directory>
MaxClientsPerHost 200
PassivePorts 55000 56000
================+================+=================

创建PROFTPD的日志文件:

# touch /var/log/proftpd.log
# touch /var/log/proftpd-tls.log
# chown nobody:nogroup /var/log/proftpd.log /var/log/proftpd-tls.log

创建SSL传输的证书和密匙:

# cp /usr/share/ssl/openssl.cnf ./
# openssl req -new -x509 -nodes -config openssl.cnf -out proftpd.crt –keyout proftpd.key
这里安装提示需要输入证书信息略

把证书和密匙复制到指定目录:
# cp proftpd.crt proftpd.key /etc/

最后创建PROFTPD启动教本:

# vi /etc/init.d/proftpd
================+================+=================
#!/bin/sh
# Startup script for ProFTPD
# chkconfig: 345 85 15
# description: ProFTPD is an enhanced FTP server
# processname: proftpd
# config: /etc/proftpd.conf
# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/proftpd ]; then
. /etc/sysconfig/proftpd
fi
PATH="$PATH:/usr/local/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
================+================+=================

# chomd 755 /etc/init.d/proftpd
# chkconfig –-add proftpd
# chkconfig proftpd on

到这里ftp服务器端安装设置完毕,登陆服务器的客户端我用了完全免费的FileZilla(前两天网上看到说FileZilla支持SSL不错)。FileZilla的设置也比较简单。本服务器支持两种客户端加密连接方式:

1. FTP over ssl (显示加密)方式连接。
2. FTP over tls (显示加密) 方式连接

本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除。
换一批
延伸阅读

3月10日消息,2026年开年,一个名为OpenClaw的开源项目以闪电般的速度席卷了GitHub。它在短短一天内就斩获了9000颗星

关键字: OpenClaw Linux

3月6日消息,在摩根士丹利会议上,NVIDIA CEO黄仁勋分享了关于Agentic AI(代理式人工智能)转折点的见解,并将开源软件OpenClaw评价为“当代最重磅的软件发布”。

关键字: OpenClaw Linux

Linux内存管理是操作系统的核心机制之一,通过虚拟内存与物理内存的分离设计,实现了多进程内存隔离、高效资源利用和系统稳定性保障。

关键字: Linux 内存

在Linux系统中,进程管理是内核的核心功能之一,其核心目标是通过高效的调度机制和进程切换技术,实现多任务并发执行。

关键字: Linux CPU

内核是操作系统的核心,它作为应用程序与硬件设备之间的"中间人",负责进程调度、内存管理、硬件通信和系统调用等关键功能。Linux和Windows作为全球使用最广泛的两大操作系统,其内核设计理念、架构和运行机制存在本质差异...

关键字: Linux Windows

在Linux系统中,当开发者使用mmap()系统调用将磁盘文件映射到进程的虚拟地址空间时,一个看似简单的指针操作背后,隐藏着操作系统内核与硬件协同工作的复杂机制。这种机制不仅突破了传统文件IO的效率瓶颈,更重新定义了内存...

关键字: Linux 文件IO 内存映射

在Linux驱动开发领域,持续集成与持续部署(CI/CD)流水线通过自动化流程将代码变更快速转化为可靠部署,而KernelCI与LTP测试套件的深度集成则成为保障驱动稳定性的关键技术组合。本文将从原理分析、应用场景及实现...

关键字: CICD流水线 Linux

在Linux系统中,动态库(共享库)是程序运行的重要组成部分。当程序需要调用动态库时,系统必须能够找到这些库文件的位置。

关键字: 动态库 Linux

ATYM是一个轻量级的运行时,用于在Linux边缘设备(如树莓派)上运行WebAssembly应用程序。ATYM不是在系统上部署大型Docker映像或直接运行本机二进制文件,而是运行小型的沙盒程序,这些程序启动速度快,使...

关键字: 树莓派 ATYM Linux 内存

在计算机网络中,端口映射(Port Forwarding)是一项关键的技术,它允许外部网络通过特定端口访问内部网络中的服务。这种技术广泛应用于家庭网络、企业环境以及云计算场景,是实现远程访问、游戏服务器搭建、FTP共享等...

关键字: Linux Windows
关闭