Debian Codegraph @

doc/utils/ftpquota.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ftpquota: tool for ProFTPD mod_quotatab</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr><br>
10 <center>
11 <h2><b><code>ftpquota</code>: tool for ProFTPD module <code>mod_quotatab</code></b></h2>
12 </center>
13 <hr><br>
14
15 This <code>ftpquota</code> program is used to create and manage quota tables,
16 for the <a href="../contrib/mod_quotatab.html"><code>mod_quotatab</code></a>
17 module, of type &quot;file&quot;.
18
19 <p>
20 The most current version of <code>ftpquota</code> is distributed with the
21 ProFTPD source code, in the <code>contrib/</code> directory.
22
23 <h2>Author</h2>
24 <p>
25 Please contact TJ Saunders &lt;tj <i>at</i> castaglia.org&gt; with any
26 questions, concerns, or suggestions regarding this program.
27
28 <p>
29 <hr><br>
30 <h2><a name="Usage">Usage</a></h2>
31 The following describes the common usage of the <code>ftpquota</code> tool.
32 The options supported are described in more detail
33 <a href="#Options">later</a>.
34
35 <p>
36 <b>Creating Tables</b><br>
37 To start using <code>mod_quotatab</code>, the two required tables are required.
38 Tables of type &quot;file&quot; have identifying magic headers such that
39 <code>ftpquota</code> is needed to initially create both tables. It is an
40 error to attempt to create a table that already exists:
41 <pre>
42 # ftpquota --create-table --type=limit
43 ftpquota: cannot create existing table
44 </pre>
45
46 <p>
47 To create the initial limit table:
48 <pre>
49 ftpquota --create-table --type=limit
50 </pre>
51 To create the initial tally table:
52 <pre>
53 ftpquota --create-table --type=tally
54 </pre>
55 The population of a tally table file with the tally for <code>user</code>s,
56 <code>group</code>s, <code>class</code>es, and <code>all</code> is done
57 automatically by <code>mod_quotatab</code>.
58
59 <p>
60 For both of these operations, the <code>--table-path</code> can be used to
61 create a table in a non-default location.
62
63 <p>
64 <b>Updating Tables</b><br>
65 Now that you have the initial tables created, but blank, you need to add
66 records (to the limit table) for the users, groups, classes, etc on which
67 you, as the administrator, wish to impose quotas.
68
69 <p>
70 To a basic limit record for a user <code>bob</code> using the default quotas
71 (which are all &quot;unlimited&quot; by default):
72 <pre>
73 ftpquota --add-record --type=limit --name=bob --quota-type=user
74 </pre>
75 Similarly for quotas of type <code>group</code> or <code>class.</code> Note
76 that for quotas of type <code>all</code>, the <code>--name</code> option
77 is not necessary; the <code>all</code> record applies to everyone, regardless
78 of name or group or class membership. If no byte or file limits are
79 specified, the default settings (<b>unlimited</b> numbers of bytes/files)
80 are used.
81
82 <p>
83 It is an error to add a record that already exists. Note, however, that it
84 is possible to have multiple records of the same name, but different
85 quota types. The record to use for a given session is identified by the
86 combination of name and quota type.
87
88 <p>
89 An example of creating a limit record with more complex quotas for a class
90 named &quot;browsers&quot;
91 <pre>
92 ftpquota --add-record --type=limit --name=browsers --quota-type=class \
93 --files-upload=0 --files-download=25 --table-path=/usr/local/etc/ftplimit.tab
94 </pre>
95 or, another way:
96 <pre>
97 ftpquota --add-record --type=limit --name=browsers --quota-type=class \
98 --bytes-upload=0 --bytes-download=2 --units=Gb --table-path=/usr/local/etc/ftplimit.tab
99 </pre>
100 In general, it is a good idea to use either byte quotas or file quotas, but
101 not both, unless you know what you are doing. In these examples, the
102 <code>--table-path</code> option is used to add the record to a limit table in
103 a non-default location.
104
105 <p>
106 Another option available when creating limit records is the
107 <code>--per-session</code> option. By default, quotas are persistent, and
108 apply to the user (or group, class, or everyone) across all sessions. Using
109 this option means the limits will be enforced only for the duration of
110 the client's session, and that the limits will apply only to that client.
111 In other words, using this option for <code>group</code>, <code>class</code>,
112 or <code>all</code> quotas is not a good idea.
113
114 <p>
115 Similarly, for removing records from the limit table (effectively removing
116 quotas from affecting that <code>user/group/class/all</code>) or from the
117 tally table (effectively resetting the quotas to zero for that
118 <code>user/group/class/all</code>), there is the
119 <code>--delete-record</code> option:
120 <pre>
121 ftpquota --delete-record --type=limit --name=browsers --quota-type=class
122 </pre>
123
124 <p>
125 In addition to adding and removing records, an administrator may want to
126 simply change the quotas in a given record, either in the limit or tally
127 tables. In this case, use <code>--update-record</code>:
128 <pre>
129 ftpquota --update-record --type=tally --name=bob --quota-type=user \
130 --bytes-download=100 --files-download=1
131 </pre>
132 This example command manually sets user <code>bob</code>'s download tally to
133 100 bytes, 1 file. It is an error to update a record that does not exist.
134
135 <p>
136 There are some administrators who wish to impose quotas on a daily basis, that
137 is, to have a per-day quota. At present, the easiest way to do this is to
138 have a cron job that, once a day, does the following:
139 <pre>
140 ftpquota --update-record --type=tally --name=<i>name</i> --quota-type=<i>quotatype</i>
141 </pre>
142 This command will &quot;reset&quot; the matching tally record. By default, if
143 no byte or file quotas are set, the default values are used: <b>unlimited</b>
144 if updating a limit record, zero if updating a tally record.
145
146 <p>
147 When editing the tables, <code>ftpquota</code> will obtain read or write
148 locks as necessary. If those tables are being used by a running server, which
149 also performs locking, the script will wait until it is able to obtain a lock.
150 Changing of in-use table information is ideally done while the server is
151 quiescent. This locking is to avoid data synchronization and corruption
152 issues.
153
154 <p>
155 <b>Showing Tables</b><br>
156 Having tables in binary format makes it difficult to easily see what
157 the current records are, to double-check limits or simply to view the
158 current tally. <code>ftpquota</code> thus supports the dumping out of
159 table contents in human-legible form via the <code>--show-records</code>
160 option:
161 <pre>
162 ftpquota --show-records --type=limit
163 </pre>
164 or, for a tally table not in the location where the scripts expects it to
165 be:
166 <pre>
167 ftpquota --show-records --type=tally --table-path=/usr/local/etc/ftpd/quota-tally.tab
168 </pre>
169 When viewing tables this way, the <code>--units</code> option can be used
170 to display byte quotas in other units (<i>e.g.</i> Kb, Mb, etc).
171
172 <p>
173 <hr><br>
174 <h2><a name="Options">Options</a></h2>
175 The following is the output from running <code>ftpquota --help</code>:
176 <pre>
177 usage: ftpquota [options]
178
179 The following options describe the type of operation to be performed:
180
181 --add-record Create a new record with the specified limits. Any
182 limits left unspecified with have their default
183 values. This option requires the --name and
184 --quota-type options.
185
186 --create-table Create the table if not present. Used to initialize
187 a table. The default limit table path is
188 "./ftpquota.limittab". The default tally table path is
189 "./ftpquota.tallytab".
190
191 --delete-record Deletes a quota record from the table. This option
192 requires the --name and --quote-type options.
193
194 --show-records Prints out all of the quota records in the table in
195 a legible format.
196
197 --update-record Updates a quota record with the specified limits. Any
198 limits left unspecified will be updated with their
199 default value. This option requires the --name and
200 --quota-type options.
201
202 The following option describes the type of table on which to operate:
203
204 --type Specifies a table type to use. The allowable options
205 are: "limit" or "tally". This is required.
206
207 The following options are used to specify specific quota limits:
208
209 --Bu Specifies the limit of the number of bytes that may be
210 --bytes-upload uploaded. Defaults to -1 (unlimited). Note that any
211 value less than or equal to zero will be treated as
212 "unlimited".
213
214 --Bd Specifies the limit of the number of bytes that may be
215 --bytes-download downloaded. Defaults to -1 (unlimited). Note that any
216 value less than or equal to zero will be treated as
217 "unlimited".
218
219 --Bx Specifies the limit of the number of bytes that may be
220 --bytes-xfer transferred. Note that this total includes uploads,
221 downloads, AND directory listings. Defaults to
222 -1 (unlimited). Note that any value less than or equal
223 to zero will be treated as "unlimited".
224
225 --Fu Specifies the limit of the number of files that may be
226 --files-upload uploaded. Defaults to -1 (unlimited). Note that any
227 value less than or equal to zero will be treated as
228 "unlimited".
229
230 --Fd Specifies the limit of the number of files that may be
231 --files-download downloaded. Defaults to -1 (unlimited). Note that any
232 value less than or equal to zero will be treated as
233 "unlimited".
234
235 --Fx Specifies the limit of the number of files that may be
236 --files-xfer transferred, including uploads and downloads. Defaults
237 to -1 (unlimited). Note that any value less than or
238 equal to zero will be treated as "unlimited".
239
240 -L Specifies the type of limit, "hard" or "soft", of
241 --limit-type the bytes limits. If "hard", any uploaded files that
242 push the bytes used counter past the limit will be
243 automatically deleted; if "soft", those extra bytes
244 will be allowed, but future uploads will be denied.
245 This option only makes sense if --type is "limit".
246
247 -N Specifies a name for the quota record. This name
248 --name will be the user/login name, group name, or class
249 name, depending on the quota type. This option
250 is ignored if the quota type specified is "all".
251
252 -P
253 --per-session Specifies that the quota limit is to be applied only
254 to each session, rather than persisting across
255 sessions. By default, quotas are persistent.
256
257 -Q Specifies a "quota type" for this record, where
258 --quota-type the type means to which category of FTP users this
259 quota will apply. The quota type must be one of:
260 "user", "group", "class", or "all".
261
262 The following options are miscellaneous:
263
264 --help Displays this message.
265
266 --table-path Specifies the path to a quota table file to use.
267
268 --units Specifies whether to treats bytes as is, in kilobytes,
269 megabytes, or gigabytes. Allowable options are:
270 "B" or "byte", "Kb" or "kilo", "Mb" or "mega",
271 and "Gb" or "giga". Defaults to "byte".
272
273 --verbose Toggles more verbose information about the doings of
274 the tool as it works.
275 </pre>
276
277 <p>
278 <hr>
279 <font size=2><b><i>
280 &copy; Copyright 2000-2017 TJ Saunders<br>
281 All Rights Reserved<br>
282 </i></b></font>
283 <hr>
284
285 </body>
286 </html>