一、pure-ftpd安装
cd /usr/local/src/
wget http://down.anxia.com/pure-ftpd-1.0.42.tar.gz
tar xf pure-ftpd-thr-1.0.32.1.tar.gz
cd pure-ftpd-thr-1.0.32.1
./configure --prefix=/usr/local/pureftpd --without-inetd --with-altlog --with-puredb --with-throttling --with-peruserlimits --with-tls
make && make install
若出现错误:
ibpureftpd_a-ls.o `test -f 'ls.c' || echo './'`ls.c
ls.c: 在函数‘donlist’中:
ls.c:869: 错误:‘passive’未声明(在此函数内第一次使用)
ls.c:869: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
ls.c:869: 错误:所在的函数内也只报告一次。)
make[2]: *** [libpureftpd_a-ls.o] 错误 1
make[2]: Leaving directory `/usr/local/src/pure-ftpd-thr-1.0.32.1/src'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/usr/local/src/pure-ftpd-thr-1.0.32.1'
make: *** [all] 错误 2
使用yum安装解决
#32位源下载地址:http://www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm
#64位下载地址:http://www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm
rpm -ivh "http://www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm"
yum install pure-ftpd -y
二、pure-ftpd配置
rpm -qa pure-ftpd #查看安装包名
pure-ftpd-1.0.30-1.el6.i686
rpm -ql pure-ftpd-1.0.30-1.el6.i686 #查看包安装位置
=================================编辑配置文件
> /etc/pure-ftpd/pure-ftpd.conf #清空配置文件
vim /etc/pure-ftpd/pure-ftpd.conf #编辑配置文件
ChrootEveryone yes BrokenClientsCompatibility no MaxClientsNumber 50 Daemonize yes MaxClientsPerIP 8 VerboseLog no DisplayDotFiles yes AnonymousOnly no NoAnonymous no SyslogFacility ftp DontResolve yes MaxIdleTime 15 PureDB /etc/pure-ftpd/pureftpd.pdb LimitRecursion 3136 8 AnonymousCanCreateDirs no MaxLoad 4 AntiWarez yes Umask 133:022 MinUID 100 AllowUserFXP no AllowAnonymousFXP no ProhibitDotFilesWrite no ProhibitDotFilesRead no AutoRename no AnonymousCantUpload no PIDFile /usr/sbin/pure-ftpd.pid MaxDiskUsage 99 CustomerProof yes
=========================================创建共享目录和认证用户
mkdir /tmp/ftp #创建ftp共享文件夹
chown -R szk:szk /tmp/ftp #授权szk用户
/usr/bin/pure-pw useradd ftpuser -uszk -d /tmp/ftp/ #生成ftp虚拟用户并映射到szk用户,指定ftp共享目录
Password:
Enter it again:
/usr/bin/pure-pw mkdb #生成库文件
/usr/bin/pure-pw list #查看列表
szk /tmp/ftp/./
==================================启动服务
/usr/sbin/pure-config.pl /etc/pure-ftpd/pure-ftpd.conf #前面是启动脚本,后面是配置文件
Running: /usr/sbin/pure-ftpd -A -c50 -B -C8 -D -fftp -H -I15 -lpuredb:/usr/sbin/pureftpd.pdb -L3136:8 -m4 -s -U133:022 -u100 -g/usr/sbin/pure-ftpd.pid -k99 -Z
netstat -tnlup | grep pure-ftpd
tcp 0 0 192.168.1.200:29608 0.0.0.0:* LISTEN 15833/pure-ftpd (ID
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 15828/pure-ftpd (SE
tcp 0 0 :::21 :::* LISTEN 15828/pure-ftpd (SE
ps aux | grep pure-ftpd
root 15828 0.0 0.1 15512 1124 ? Ss 14:44 0:00 pure-ftpd (SERVER)
ftp 15833 0.0 0.1 15516 1464 ? S 14:46 0:00 pure-ftpd (IDLE)
root 15834 0.0 0.0 15516 1016 ? S 14:46 0:00 pure-ftpd (PRIV
三、客户端验证
yum install -y lftp #安装ftp客户端工具
lftp [email protected]
yum install ftp -y
ftp 192.168.1.201
ftp> ls
227 Entering Passive Mode (192,168,1,201,159,251)
150 Accepted data connection
drwxr-xr-x 2 500 szk 4096 Jan 24 15:46 .
drwxr-xr-x 2 500 szk 4096 Jan 24 15:46 ..
226-Options: -a -l
226 2 matches total