1、下载解压pureftp
[root@daixuan ~]# cd /usr/local/src/
[root@daixuan src]# wget https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.42.tar.gz
[root@daixuan src]# tar zxvf pure-ftpd-1.0.42.tar.gz
[root@daixuan src]# ls
httpd-2.2.31 php-5.4.45
httpd-2.2.31.tar.gz pure-ftpd-1.0.42
mirror pure-ftpd-1.0.42.tar.gz
2、配置编译参数
[root@daixuan src]# cd pure-ftpd-1.0.42
[root@daixuan pure-ftpd-1.0.42]# ./configure \
> --prefix=/usr/local/pureftpd \
> --without-inetd \
> --with-altlog \
> --with-puredb \
> --with-throttling \
> --with-peruserlimits \
> --with-tls
3、编译
[root@daixuan pure-ftpd-1.0.42]# make
4、安装
[root@daixuan pure-ftpd-1.0.42]# make install
5、新建启动的目录,修改pureftp的配置文件
[root@daixuan pure-ftpd-1.0.42]# mkdir -p /usr/local/pureftpd/etc
[root@daixuan pure-ftpd-1.0.42]# cd configuration-file/
[root@daixuan configuration-file]# ls
Makefile pure-config.pl pure-config.py.in
Makefile.am pure-config.pl.in pure-ftpd.conf
Makefile.in pure-config.py pure-ftpd.conf.in
[root@daixuan configuration-file]# cp pure-ftpd.conf /usr/local/pureftpd/etc/pure-ftpd.conf
[root@daixuan configuration-file]# cp pure-config.pl /usr/local/pureftpd/sbin/pure-config.pl
[root@daixuan configuration-file]# chmod 755 /usr/local/pureftpd/sbin/pure-config.pl
[root@daixuan configuration-file]# vim /usr/local/pureftpd/etc/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 /usr/local/pureftpd/etc/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/local/pureftpd/var/run/pure-ftpd.pid MaxDiskUsage 99 CustomerProof yes
6、启动ftp
[root@daixuan configuration-file]# /usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
Running: /usr/local/pureftpd/sbin/pure-ftpd -c50 -B -C8 -D -fftp -H -I15 -lpuredb:/usr/local/pureftpd/etc/pureftpd.pdb -L3136:8 -m4 -s -U133:022 -u100 -g/usr/local/pureftpd/var/run/pure-ftpd.pid -k99 -Z
7、建立账号
[root@daixuan configuration-file]# mkdir /tmp/ftp
[root@daixuan configuration-file]# tail /etc/passwd/
user3:x:506:512::/home/user3:/bin/false
[root@daixuan configuration-file]# chown -R user3 /tmp/ftp
添加ftp虚拟登录用户ftpuser1并输入密码
[root@daixuan configuration-file]# /usr/local/pureftpd/bin/pure-pw useradd ftpuser1 -uuser3 -d /tmp/ftp/
Password:
Enter it again:
8、如何登录pureftp
首先可以查看pureftp的进程
[root@daixuan ~]# ps aux | grep pure
root 31763 0.0 0.0 8628 580 ? Ss 13:12 0:00 pure-ftpd (SERVER)
root 31838 1.0 0.0 6048 784 pts/0 S+ 13:26 0:00 grep pure
[root@daixuan ~]# !netstat
netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2370/mysqld
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 31763/pure-ftpd (SE
[root@daixuan ~]# yum install -y lftp
[root@daixuan ~]# lftp [email protected]
口令:
lftp [email protected]:~> ls
中断,这里有问题,查看日志,
[root@daixuan ~]# tail /var/log/messages
Dec 21 14:29:58 daixuan pure-ftpd: ([email protected]) [ERROR] Unable to read the indexed puredb file (or old format detected) - Try pure-pw mkdb
解决办法,建立虚拟用户数据库:
[root@daixuan ~]# /usr/local/pureftpd/bin/pure-pw mkdb
[root@daixuan ~]# lftp [email protected]
口令:
lftp [email protected]:~> ls
drwxr-xr-x 2 506 0 4096 Dec 21 13:14 .
drwxr-xr-x 2 506 0 4096 Dec 21 13:14 ..
lftp [email protected]:/>
lftp [email protected]:/> mkdir 12.txt
mkdir 成功, 建立 `12.txt'
lftp [email protected]:/> exit
[root@daixuan ~]# cd /tmp/ftp
[root@daixuan ftp]# ls
12.txt