The guestuser line works exactly like the guestgroup command you just read about, except it specifies a user ID (UID) instead of a group ID. Here's the command:
guestuser <username> [<username>]
This command limits the guest user to files for which the user has privileges. Generally, a user has more privileges than a group, so this type of assignment can be less restrictive than the guestgroup line.
The limit command restricts the number of users in a class during given times. Here is the command, which contains fields for specifying a class, a number of users, a time range, and the name of a text file that contains an appropriate message:
limit <class> <n> <times> <message_file>
If the specified number of users from the listed class is exceeded during the given time period, the user sees the contents of the file given in the message_file parameter.
The times parameter is somewhat terse. Its format is a comma-delimited string in the form of days, hours. Valid day strings are Su, Mo, Tu, We, Th, Fr, Sa, and Any. The hours string is formatted in a 24-hour format. An example is as follows:
limit anonymous 10 MoTuWeThFr,Sa0000-2300 /home/ftp/.message_limit_anon_class
This line limits the anonymous class to 10 concurrent connections on Monday through Friday, and on Saturday from midnight to 11:00 p.m. For example, if the number of concurrent connections is exceeded at 11:00 p.m. on Saturday, the users will see the contents of the file /home/ftp/.message_limit_anon_class.
Syntax for finer control over limiting user connections can be found in the ftpaccess man page.
This line allows control over how many times a user can enter an invalid password before the FTP server terminates the session:
loginfails <number>
The default for loginfails is set to 5. This command prevents users without valid passwords from experimenting until they get it right.
Configure User Information
Providing users with information about the server and its use is a good practice for any administrator of a public FTP server. Adequate user information can help prevent user problems and eliminate tech support calls. You also can use this information to inform users of restrictions governing the use of your FTP server. User information gives you an excellent way to document how your FTP server should be used.
You can use the commands detailed in the following sections to display messages to users as they log in to the server and as they perform specific actions. The following commands enable messages to be displayed to users when logging in to the server and when an action is performed.
This command is a reference to a file that is displayed before the user receives a login prompt from the FTP server:
banner <path>
This file generally contains information to identify the server. The path is an absolute pathname relative to the system root (/), not the base of the anonymous FTP user's home. The entry might look like this:
banner /etc/rh8ftp.banner
This example uses the file named rh8ftp.banner under the /etc directory. The file can contain one or more lines of text, such as:
Welcome to Widget, Inc.'s Red Hat Linux FTP server.
This server is only for use of authorized users.
Third-party developers should use a mirror site.
When an FTP user attempts to log in, the banner is displayed like so:
$ ftp shuttle2
Connected to shuttle2.home.org.
220-Welcome to Widget, Inc.'s Red Hat Linux FTP server.
220-This server is only for use of authorized users.
220-Third-party developers should use a mirror site.
220-
220-
220 shuttle2 FTP server (Version wu-2.6.2-8) ready.
504 AUTH GSSAPI not supported.
504 AUTH KERBEROS_V4 not supported.
KERBEROS_V4 rejected as an authentication type
Name (shuttle2:phudson):
Note that the banner does not replace the greeting text that, by default, displays the hostname and server information, such as:
220 shuttle2 FTP server (Version wu-2.6.2-8) ready.
To hide version information, use the greeting command in ftpaccess with a keyword, such as terse, like so:
greeting terse
FTP users then see a short message like this as part of the login text:
220 FTP server ready.
Also, not all FTP clients can handle multiline responses from the FTP server. The banner <path> command is what the banner line uses to pass the file contents to the client. If clients cannot interrupt multiline responses, the FTP server is useless to them. You should also edit the default banner to remove identity and version information.
This line specifies a text file to be displayed to the user during login and when the user issues the cd command:
message <path> {<when> {<class> ...}}
The optional when clause can be LOGIN or CWD=(dir), where dir is the name of a directory that is current. The optional class parameter enables messages to be shown to only a given class or classes of users.
Using messages is a good way to give information about where things are on your site as well as information that is system dependent, such as alternative sites, general policies regarding available data, server availability times, and so on.
You can use magic cookies to breathe life into your displayed messages. Magic cookies are symbolic constants that are replaced by system information. Table 20.1 lists the message command's valid magic cookies and their representations.
TABLE 20.1 Magic Cookies and Their Descriptions
| Cookie | Description |
|---|---|
%T |
Local time (form Thu Nov 15 17:12:42 1990) |
%F |
Free space in partition of CWD (kilobytes) [Not supported on all systems] |
%C |
Current working directory |
%E |
Maintainer's email address as defined in ftpaccess |
%R |
Remote hostname |
%L |
Local hostname |
%u |
Username as determined via RFC931 authentication |
%U |
Username given at login time |
%M |
Maximum allowed number of users in this class |
%N |
Current number of users in this class |
%B |
Absolute limit on disk blocks allocated |
%b |
Preferred limit on disk blocks |
%Q |
Current block count |
%I |
Maximum number of allocated inodes (+1) |
%i |
Preferred inode limit |
%q |
Current number of allocated inodes |
%H |
Time limit for excessive disk use |
%h |
Time limit for excessive files |
| Ratios | |
%xu |
Uploaded bytes |
%xd |
Downloaded bytes |
%xR |
Upload/download ratio (1:n) |
%xc |
Credit bytes |
%xT |
Time limit (minutes) |
%xE |
Elapsed time since login (minutes) |
%xL |
Time left |
%xU |
Upload limit |
%xD |
Download limit |