【资料整理】proftpd安装配置
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
1)下载安装
wget
ftp
:
//ftp
.proftpd.org
/distrib/source/proftpd-1
.3.4c.
tar
.gz
tar
zxvf proftpd-1.3.4c.
tar
.gz
cd
proftpd-1.3.4c
(启用配额模块,限制上传大小,如果重新configure,则需要先
make
distclean)
.
/configure
--with-modules=mod_quotatab:mod_quotatab_file
make
make
install
默认将安装在
/usr/local/sbin
和
/usr/local/bin
目录下。
2)配置
开机启动:
cp
contrib
/dist/rpm/proftpd
.init.d
/etc/rc
.d
/init
.d
/proftpd
vim
/etc/init
.d
/proftpd
找到下列内容:
# Make sure the binary is present.
[ -x
/usr/sbin/proftpd
] ||
exit
5
更换为:
[ -x
/usr/local/sbin/proftpd
] ||
exit
5
增加权限:
chmod
755
/etc/init
.d
/proftpd
chkconfig --add proftpd
chkconfig proftpd on
增加用户和组:
groupadd ftpuser1
useradd
ftpuser1 -g ftpuser1 -d
/home/ftpuser1
-s
/sbin/nologin
passwd
ftpuser1
增加上传目录:
mkdir
-p
/home/ftpuser1/upload
chown
ftpuser1:ftpuser1
/home/ftpuser1/upload
检查IPTABLES是否开放FTP端口
修改配置文件:
vi
/usr/local/etc/proftpd
.conf
[root@test120 ~]
# cat /usr/local/etc/proftpd.conf
ServerName
"ec-ftp-server"
ServerType standalone
DefaultServer on
Port 21
UseIPv6 off
Umask 022
User ftpuser1
Group ftpuser1
DefaultRoot ~
/upload
AllowOverwrite on
#AllowForeignAddress on
#AllowRetrieveRestart on
#AllowStoreRestart on
MaxInstances 30
#MAXConnectionRate 4
#MaxClients 10 "Sorry, the maximum number of clients (%m) are already connected."
#MaxClientsPerUser 1 "Sorry, the maximum number of clients (%m) for this user are already connected."
#MaxClientsPerHost 1 "Sorry, one client per host, please."
#MaxHostsPerUser 1
ServerIdent off
USEReverseDNS off
IDentLookups off
DirFakeUser on
DirFakeGroup on
DeferWelcome on
<IfModule mod_quotatab.c>
QuotaEngine on
QuotaLog
/var/log/quota
.log
<IfModule mod_quotatab_file.c>
QuotaLimitTable
file
:
/usr/local/etc/ftpquota
.limittab
QuotaTallyTable
file
:
/usr/local/etc/ftpquota
.tallytab
<
/IfModule
>
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
QuotaOptions ScanOnLogin
<
/IfModule
>
SystemLog
/var/log/proftpd
.log
<Limit SITE_CHMOD>
DenyAll
<
/Limit
>
<Limit LOGIN>
AllowUser ftpuser1
DenyAll
<
/Limit
>
<Limit SITE_QUOTA>
AllowUser ftpuser1
DenyAll
<
/Limit
>
<Directory
"/home/ftpuser1/upload"
>
<Limit ALL>
DenyAll
<
/Limit
>
<Limit STOR>
AllowUser ftpuser1
DenyAll
<
/Limit
>
<
/Directory
>
用户上传文件配额设置(限额5GB):
ftpquota -create -
type
=tally -table-path=
/usr/local/etc/ftpquota
.tallytab
ftpquota -create -
type
=limit -table-path=
/usr/local/etc/ftpquota
.limittab
ftpquota --
type
=limit --table-path=
/usr/local/etc/ftpquota
.limittab --add-record --
quota
-
type
=user --name=ftpuser1 --
units
=Gb --bytes-upload=5
启动proftpd:
service proftpd start
(如果是重新编译模块再安装,则要重启该服务以获得新功能,service proftpd restart)
3. 测试
ftp
>
open
1.2.3.4
连接到 1.2.3.4。
220 1.2.3.4 FTP server ready
用户(1.2.3.4:(none)): ftpuser1
331 Password required
for
ftpuser1
密码:
230 User ftpuser1 logged
in
ftp
> quote SITE QUOTA
200-The current
quota
for
this session are [current
/limit
]:
Name: ftpuser1
Quota Type: User
Per Session: False
Limit Type: Hard
Uploaded Mb: 0.00
/5120
.00
Downloaded Mb: unlimited
Transferred Mb: unlimited
Uploaded files: unlimited
Downloaded files: unlimited
Transferred files: unlimited
200 Please contact root@2.3.4.5
if
these entries are inaccurate
ftp
>
任务完成。
|
本文转自 pcnk 51CTO博客,原文链接:http://blog.51cto.com/nosmoking/1595598,如需转载请自行联系原作者