Write by lyc at 2020-2-4
pure-ftpd 官网
pure-ftpd 官方文档
CentOS7 安装 Pure-ftpd

一、pure-ftpd 安装

1.pure-ftpd 安装

1
2
$ yum install epel-release
$ yum install pure-ftpd

2.pure-ftpd.conf 配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$ cp -pv /etc/pure-ftpd/pure-ftpd.conf{,.default}
$ vim /etc/pure-ftpd/pure-ftpd.conf
ChrootEveryone yes
#TrustedGID 1000
BrokenClientsCompatibility no
MaxClientsNumber 100
Daemonize yes
MaxClientsPerIP 16
VerboseLog no
DisplayDotFiles no
AnonymousOnly no
NoAnonymous yes
SyslogFacility ftp
AltLog clf:/var/log/pureftpd.log
DontResolve yes
MaxIdleTime 5
#MySQLConfigFile /etc/pure-ftpd/pureftpd-mysql.conf
PureDB /etc/pure-ftpd/pureftpd.pdb
PIDFile /var/run/pure-ftpd.pid
PAMAuthentication no
UnixAuthentication yes
#MinUID 500
LimitRecursion 30000 8
AnonymousCanCreateDirs no
#MaxLoad 4
MaxLoad 10
PassivePortRange 49000 50000
AntiWarez yes
UserBandwidth 1024000
Umask 133:022
AllowUserFXP yes
AllowAnonymousFXP no
ProhibitDotFilesWrite no
ProhibitDotFilesRead no
AutoRename no
#CallUploadScript yes
AnonymousCantUpload no
MaxDiskUsage 99
CustomerProof yes
Bind 0.0.0.0,21

3.pure-ftpd 启动服务

1
2
$ systemctl start pure-ftpd.service
$ systemctl enable pure-ftpd.service

二、pure-ftpd 用户管理

1.创建系统用户 pure-ftpd

1
2
$ groupadd pure-ftpd -g 600
$ useradd -g 600 -u 600 -d /dev/null -s /sbin/nologin pure-ftpd

2.创建上传目录

1
2
$ mkdir -p /data/ftp
$ chown -R pure-ftpd.pure-ftpd /data/ftp

3.创建 pure-ftpd 虚拟用户

1
2
3
4
5
$ pure-pw useradd admin -u pure-ftpd -g pure-ftpd -d /data/ftp -m
Password: xxxxxxxxxxxxxxxx
Enter it again: xxxxxxxxxxxxxxxx

$ pure-pw mkdb
  • -u 选项将虚拟用户与系统用户关联在一起,即使用admin账号登录FTP后,会以pure-ftpd的身份来读取和下载文件
  • -g 指定系统用户的组
  • -d 选项后面的目录为虚拟用户的家目录
  • -m 把用户密码写入PDB数据库中,不需要重启pure-ftpd服务
  • pure-pw mkdb 把账户信息写入pdb文件

4.查看 pure-ftpd 虚拟用户

1
2
3
4
5
# 查看所有用户
$ pure-pw list

# 查看指定用户
$ pure-pw show admin

5.修改 pure-ftpd 虚拟用户密码

1
$ pure-pw passwd admin

最后注意:外网防火墙或iptaebls放行49000-50000被动端口