Customizing Message Files
You can configure the FTP server to return messages that are related to specific events to the FTP client. A welcome message might be set to display when a user logs in to the FTP server. Another message could appear when the user makes a directory change.
In addition to plain text, message files can contain one or more magic cookies. A magic cookie is composed of a % (percent sign), followed by a single character. When you embed a cookie in message text, information that is associated with the cookie appears on screen at the point the message file is called.
For example, message text might contain the cookie %L:
Welcome to %L!
When the message is displayed, the magic cookie %L is replaced with the name of the server as defined by the hostname statement in the ftpaccess file. For a complete list of supported message cookies, see ftpaccess(4).
Note - If the host name is not defined in the ftpaccess file, the default host name for the local machine is used.
How to Customize Message Files
The following is an example of a message file that includes magic cookies:
Welcome to %L -- local time is %T. You are number %N out of a maximum of %M. All transfers are logged. If your FTP client crashes or hangs shortly after login please try using a dash (-) as the first character of your password. This will turn off the informational messages that may be confusing your FTP client. Please send any comments to %E.
How to Create Messages to Be Sent to Users
After the user is logged in, system-related or application-related messages are displayed on screen. The ftpaccess file lists the events that trigger associated message statements.
message /etc/ftpd/Welcome login anon guest message .message cwd=*
The preceding example states that the file /etc/ftpd/Welcome is displayed at login for users of the class anon or guest. The second line states that the .message file in the current working directory is displayed for all users.
Message files are created relative to the chroot directory for guest and anonymous users.
How to Configure the README Option
The first time a directory is visited, README files can be listed. To configure the README option, add the following entries to the ftpaccess file.
readme README* login readme README* cwd=*
The previous example states that any files that match README* are listed at login or when a directory is changed. Here is a sample login that is based on the settings that are used in that example.
% ftp earth Connected to earth. 220 earth FTP server ready. Name (earth:rimmer): ftp 331 Guest login ok, send your complete e-mail address as password. Password: 230- 230-Welcome to earth -- local time is Thu Jul 15 16:13:24 1999. 230- 230-You are number 1 out of a maximum of 10. 230-All transfers are logged. 230- 230-If your FTP client crashes or hangs shortly after login please try 230-using a dash (-) as the first character of your password. This will 230-turn off the informational messages that may be confusing your FTP 230-client. 230- 230-Please send any comments to [email protected] 230- 230 Guest login ok, access restrictions apply. ftp> cd pub 250-Please read the file README 250- it was last modified on Thu Jul 15 16:12:25 1999 - 0 days ago 250 CWD command successful. ftp> get README /tmp/README 200 PORT command successful. 150 Opening ASCII mode data connection for README (0 bytes). 226 ASCII Transfer complete. ftp> quit 221 Goodbye.