一、
[bash autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”true” language=”title="example-filename.php”]
[root@rs_200_142 src]# wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.28.tar.gz
[root@rs_200_142 src]# tar -zxvf pure-ftpd-1.0.28.tar.gz
[root@rs_200_142 src]# cd pure-ftpd-1.0.28
[root@rs_200_142 pure-ftpd-1.0.28]# ./configure –prefix=/usr/local/pureftpd –with-language=simplified-chinese –with-puredb
[root@rs_200_142 pure-ftpd-1.0.28]# make && make install
[root@rs_200_142 pure-ftpd-1.0.28]# mkdir /usr/local/pureftpd/etc
[root@rs_200_142 pure-ftpd-1.0.28]# mkdir /usr/local/pureftpd/var
[root@rs_200_142 pure-ftpd-1.0.28]# cd /usr/local/pureftpd/etc
[root@rs_200_142 etc]# vi pure-ftpd.conf
ChrootEveryone yes
BrokenClientsCompatibility no
MaxClientsNumber 1150
Daemonize yes
MaxClientsPerIP 20
VerboseLog no #是否记录所有客户命令
DisplayDotFiles no
AnonymousOnly no
NoAnonymous yes
SyslogFacility none
DontResolve yes
MaxIdleTime 1
PureDB /usr/local/pureftpd/etc/pureftpd.pdb
LimitRecursion 2000 8
AnonymousCanCreateDirs no
MaxLoad 4
PassivePortRange 64400 65535
AntiWarez yes
Umask 111:000
MinUID 500
AllowUserFXP no
AllowAnonymousFXP no
ProhibitDotFilesWrite yes
ProhibitDotFilesRead yes
AutoRename no
AnonymousCantUpload yes
PIDFile /usr/local/pureftpd/var/pure-ftpd.pid
MaxDiskUsage 95
CustomerProof yes
PerUserLimits 20:0
IPV4Only yes
CreateHomeDir yes
ClientCharset=gbk #必设,防止Windows登录出现中文乱码[/bash]
二、启动脚本
[bash autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”true” language=”title="example-filename.php”]
[root@rs_200_142 etc]# cp /usr/local/src/pure-ftpd-1.0.28/configuration-file/pure-config.pl /usr/local/pureftpd/sbin/
[root@rs_200_142 etc]# chmod 755 /usr/local/pureftpd/sbin/pure-config.pl
[root@rs_200_142 etc]# vi /usr/local/pureftpd/sbin/pureftpd.sh[/bash]
[bash autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”true” language=”title="example-filename.php”]#!/bin/sh
PUREFTPD=/usr/local/pureftpd/sbin/pure-config.pl
CONF=/usr/local/pureftpd/etc/pure-ftpd.conf
PID_FILE=/usr/local/pureftpd/var/pure-ftpd.pid
case $1 in
start)
${PUREFTPD} ${CONF} &
;;
stop)
kill -9 `cat ${PID_FILE}`
;;
reload)
kill -1 `cat ${PID_FILE}`
;;
restart)
$0 stop
sleep 1
$0 start
;;
esac[/bash]
三、创建用户
[bash autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”true” language=”title="example-filename.php”]
[root@rs_200_142 etc]# groupadd ftpgroup
[root@rs_200_142 etc]# useradd -g ftpgroup -s /sbin/nologin -d /home/test test[/bash]
四、
1、创建虚拟用户
[bash autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”true” language=”title="example-filename.php”]
[root@rs_200_142 etc]# /usr/local/pureftpd/bin/pure-pw useradd ftpuser -u test -d /home/ftpuser -m[/bash]
其中:
-u 将虚拟用户 ftpuser 同系统用户 test 关联在一起。
-d 参数使 ftpuser 只能访问其 home 目录。而如果想让他访问整个文件系统,可以用 -D 选项。
执行完上述命令后,会提示输入密码,两次输入 ftpuser 用户的密码即可。用户的口令会根据系统对加
密方式的支持情况,选择一个最安全的方式进行加密。
注:如果设了CreateHomeDir
设置为 yes 创建新虚拟用户时 pureftpd 自动创建用户的主目录。
但是有一点需要大家注意,就是它只支持二层目录的建立而不支持三层以上目录的建立
2、删除用户
[bash autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”true” language=”title="example-filename.php”]
[root@rs_200_142 etc]# /usr/local/pureftpd/bin/pure-pw userdel ftpuser -f /usr/local/pureftpd/etc/pureftpd.passwd -m[/bash]
3、修改密码
[bash autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”true” language=”title="example-filename.php”]
[root@rs_200_142 etc]# /usr/local/pureftpd/bin/pure-pw passwd ftpuser -f /usr/local/pureftpd/etc/pureftpd.passwd -m[/bash]
注意问题:
ftp有主动与被动方式
ftp服务器上要允许高端口通过