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).
If the host name is not defined in the ftpaccess file, the default host name for the local machine is used.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.
Edit your message file to include magic cookies as appropriate.
See ftpaccess(4) for a list of cookies you can use.
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. |
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.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.
Add the following entries to the ftpaccess file:
message message-file [when [class ...]] |
Keyword that is used to specify the message file to be displayed when a user logs in or executes the command to change the working directory.
Name of the message file to be displayed.
Parameter that is set as login or cwd=dir. See the following example.
The class specification allows the message to be displayed only to members of a particular class.
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.
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.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.
Add the following entries to the ftpaccess file.
readme message-file [when [class...]] |
Keyword that is used to specify a message file to be checked when a user logs in or changes the working directory. If the message file exists, the user is notified and is given the date the file was modified.
Name of the message file to be checked.
Parameter that is set as login or cwd=dir. See the following example.
The class specification allows the message to be displayed only to members of a particular class.
The greeting and banner keywords can also be used to send messages to users. See ftpaccess(4).
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 ftpadmin@earth. 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. |