<chapter id="wuftp-17"><title>Administering the FTP Server (Tasks)</title><highlights><para>This chapter includes tasks that are described in the following table
to set up and administer an FTP server.</para><itemizedlist><listitem><para><olink targetptr="wuftp-231" remap="internal">Administering the FTP Server
(Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="wuftp-43" remap="internal">Controlling FTP Server Access</olink></para>
</listitem><listitem><para><olink targetptr="wuftp-10" remap="internal">Setting Up FTP Server Logins</olink></para>
</listitem><listitem><para><olink targetptr="wuftp-29" remap="internal">Customizing Message Files</olink></para>
</listitem><listitem><para><olink targetptr="wuftp-14" remap="internal">Controlling Access to Files on
the FTP Server</olink></para>
</listitem><listitem><para><olink targetptr="wuftp-15" remap="internal">Controlling Uploads and Downloads
on the FTP Server</olink></para>
</listitem><listitem><para><olink targetptr="wuftp-15a2" remap="internal">Virtual Hosting</olink></para>
</listitem><listitem><para><olink targetptr="wuftp-189" remap="internal">Starting the FTP Server Automatically</olink></para>
</listitem><listitem><para><olink targetptr="wuftp-203" remap="internal">Shutting Down the FTP Server</olink></para>
</listitem><listitem><para><olink targetptr="wuftp-210" remap="internal">Debugging the FTP Server</olink></para>
</listitem><listitem><para><olink targetptr="egcom" remap="internal">Configuration Help for Busy Sites</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="wuftp-231"><title>Administering the FTP Server (Task Map)</title><table frame="all" pgwide="1" id="wuftp-tbl-227"><title>Task Map: Administering
the FTP Server</title><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="73.21*"/><colspec colname="col2" colwidth="111.15*"/><colspec colname="colspec3" colwidth="202.64*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Configure access to the FTP server</para>
</entry><entry><para>Use the <filename>ftpaccess</filename>, <filename>ftpusers</filename>,
and the <filename>ftphosts</filename> files in the <filename>/etc/ftpd</filename> directory
to establish or restrict access to the FTP server.</para>
</entry><entry><para><olink targetptr="wuftp-162" remap="internal">How to Set User Login Limits</olink></para><para><olink targetptr="wuftp-167" remap="internal">How to Control the Number of Invalid Login
Attempts</olink></para><para><olink targetptr="wuftp-44a" remap="internal">How to Disallow FTP Server Access to Particular
Users</olink></para><para><olink targetptr="wuftp-51" remap="internal">How to Restrict Access to the Default FTP
Server</olink></para><para><olink targetptr="wuftp-45" remap="internal">How to Define FTP Server Classes</olink></para>
</entry>
</row><row><entry><para>Set up FTP server logins</para>
</entry><entry><para>Establish login accounts for real, guest and anonymous users.</para>
</entry><entry><para><olink targetptr="wuftp-153" remap="internal">How to Set Up Real FTP Users</olink></para><para><olink targetptr="wuftp-18" remap="internal">How to Set Up Guest FTP Users</olink></para><para><olink targetptr="wuftp-18g" remap="internal">How to Set Up Anonymous FTP Users</olink></para><para><olink targetptr="wuftp-18-a" remap="internal">How to Create the /etc/shells file</olink></para>
</entry>
</row><row><entry><para>Customize message files</para>
</entry><entry><para>Edit the <filename>/etc/ftpd/ftpaccess</filename> file to configure
the FTP server to return messages to the FTP client related to specific events.</para>
</entry><entry><para><olink targetptr="wuftp-31" remap="internal">How to Customize Message Files</olink></para><para><olink targetptr="wuftp-37" remap="internal">How to Create Messages to Be Sent to Users</olink></para><para><olink targetptr="wuftp-79" remap="internal">How to Configure the README Option</olink></para>
</entry>
</row><row><entry><para>Configure access to files on  the FTP server</para>
</entry><entry><para>Use the <filename>/etc/ftpd/ftpaccess</filename> file to specify classes
of users who are allowed to execute certain commands or to download and upload
files to the FTP server.</para>
</entry><entry><para><olink targetptr="wuftp-63" remap="internal">How to Configure DA Discovery for Dial-up
Networks</olink></para><para><olink targetptr="wuftp-15" remap="internal">Controlling Uploads and Downloads on the
FTP Server</olink></para>
</entry>
</row><row><entry><para>Enable limited or complete virtual hosting</para>
</entry><entry><para>Use the <filename>/etc/ftpd/ftpaccess</filename> file to configure the
FTP server to support multiple domains on the same machine.</para>
</entry><entry><para><olink targetptr="wuftp-179" remap="internal">How to Enable Limited Virtual Hosting</olink></para><para><olink targetptr="wuftp-184" remap="internal">How to Enable Complete Virtual Hosting</olink></para>
</entry>
</row><row><entry><para>Start the FTP server</para>
</entry><entry><para>Change the service properties to start the FTP server in <literal>nowait</literal>,
standalone mode or foreground mode.</para>
</entry><entry><para><olink targetptr="wuftp-191" remap="internal">How to Start an FTP Server Using SMF</olink></para><para><olink targetptr="wuftp-197" remap="internal">How to Start a Standalone FTP Server in
the Background</olink></para><para><olink targetptr="egcoo" remap="internal">How to Start a Standalone FTP Server in the
Foreground</olink></para>
</entry>
</row><row><entry><para>Shut down the FTP server</para>
</entry><entry><para>Use the <filename>/etc/ftpd/ftpaccess</filename> file and run the <command>ftpshut</command> to shut down the FTP server.</para>
</entry><entry><para><olink targetptr="wuftp-203" remap="internal">Shutting Down the FTP Server</olink></para>
</entry>
</row><row><entry><para>Troubleshoot some common FTP server problems</para>
</entry><entry><para>Check <filename>syslogd</filename> and use  <literal>greeting text</literal> and <literal>log commands</literal> to debug problems on the FTP server.</para>
</entry><entry><para><olink targetptr="wuftp-proc-221" remap="internal">How to Check syslogd for FTP Server
Messages</olink></para><para><olink targetptr="wuftp-proc-211" remap="internal">How to Use greeting text to Verify
ftpaccess</olink></para><para><olink targetptr="wuftp-proc-217" remap="internal">How to Check the Commands Executed
by FTP Users</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1><sect1 id="wuftp-43"><title>Controlling FTP Server Access</title><itemizedlist><para>You can use the following configuration files in the <filename>/etc/ftpd</filename> directory
to control access to the FTP server. </para><listitem override="bullet"><para><filename>ftpusers</filename> is used to
list users who are denied access to the FTP server.</para>
</listitem><listitem override="bullet"><para><filename>ftphosts</filename> is used to
allow or deny login from various hosts to various accounts on the FTP server.</para>
</listitem><listitem override="bullet"><para><filename>ftpaccess</filename> is the main
FTP configuration file. The FTP server only reads the <filename>/etc/ftpd/ftpaccess</filename> file if called with the <command>-a</command> option. When the <filename>ftpaccess</filename> file is used, all users must be members of a class to
be allowed access to the FTP server. You can specify many <filename>ftpaccess</filename> directives
that apply only to a particular class.</para><para>For further information,
see <olink targetdoc="refman4" targetptr="ftpusers-4" remap="external"><citerefentry><refentrytitle>ftpusers</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, <olink targetdoc="refman4" targetptr="ftphosts-4" remap="external"><citerefentry><refentrytitle>ftphosts</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, and <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>.</para><note><para>In all FTP server configuration files, lines beginning with #
signs are treated as comments. </para>
</note>
</listitem>
</itemizedlist><task id="wuftp-45"><title>How to Define FTP Server Classes</title><tasksummary><para>To log in to the FTP server, users must be members of a class when the <filename>ftpaccess</filename> file is used. To add the <literal>class</literal> directive
to the <filename>ftpaccess</filename> file, you specify the <replaceable>class</replaceable> name, <replaceable>typelist</replaceable> of users who are permitted access from a particular
host.</para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-48"><para>Add entries for anonymous, guest, and real
users in the <filename>ftpaccess</filename> file.</para><screen>class <replaceable>class</replaceable> <replaceable>typelist</replaceable> <replaceable>addrglob</replaceable>[<replaceable>addrglob...</replaceable>]</screen><variablelist><varlistentry><term><literal>class</literal></term><listitem><para>Keyword that is used to define FTP users.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>class</replaceable></term><listitem><para>A name that is defined by the <literal>class</literal> keyword.
Each login is compared against a list of defined classes. The logged in user
is considered a member of the first class matched.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>typelist</replaceable></term><listitem><para>A comma-separated list of the keywords that match the three
types of users: <literal>anonymous</literal>, <literal>guest</literal>, and <literal>real</literal>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>addrglob</replaceable></term><listitem><para>A globbed domain name or a globbed numeric address. The <replaceable>addrglob</replaceable> can also be the name of a file, starting with a slash
(`/`), which contains additional address globs: <literal>address:netmask</literal> or <literal>address/cidr</literal>.</para><itemizedlist><para>Here are some examples of globbed addresses:</para><listitem><para>Numeric IPv4 address: <userinput>10.1.2.3</userinput></para>
</listitem><listitem><para>Globbed domain name <userinput>*.provider.com</userinput></para>
</listitem><listitem><para>Globbed numeric IPv4 address <userinput>10.1.2.*</userinput></para>
</listitem><listitem><para>Numeric IPv4 address:netmask <userinput>10.1.2.0:255.255.255.0</userinput></para>
</listitem><listitem><para>Numeric IPv4 address/CIDR <userinput>10.1.2.0/24</userinput></para>
</listitem><listitem><para>Numeric IPv6 address: <userinput>2000::56:789:21ff:fe8f:ba98</userinput></para>
</listitem><listitem><para>Numeric IPv6 address/CIDR: <userinput>2000::56:789:21ff:fe8f:ba98/120</userinput></para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example><title>Defining FTP Server Classes</title><screen>class  local  real,guest,anonymous *.provider.com
class  remote real,guest,anonymous *</screen><para>The previous example defines the <literal>local</literal> class as any
user of the type <literal>real</literal>, <literal>guest</literal>, or <literal>anonymous</literal> who logs in from <literal>*.provider.com</literal>. The last line
defines <literal>remote</literal> as any user who logs in from anywhere other
than <literal>*.provider.com</literal>.</para>
</example>
</task><task id="wuftp-162"><title>How to Set User Login Limits</title><tasksummary><para>You can limit the number of simultaneous logins by users of a certain
class with directives that are set in the <filename>ftpaccess</filename> file.
Each login limit contains the name of a class, a UUCP-style days-of-week list,
and a message file to display if the limit is exceeded.</para><para>To set user login limits, follow the steps in the next procedure.</para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-165"><para>Add the following entries to the <filename>ftpaccess</filename> file:</para><screen>limit <replaceable>class</replaceable> <replaceable>n</replaceable> <replaceable>times</replaceable> [<replaceable>message-file</replaceable>]</screen><variablelist><varlistentry><term><literal>limit</literal></term><listitem><para>Keyword that is used to restrict simultaneous logins by the
specified number of users of a defined class at certain connection times.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>class</replaceable></term><listitem><para>A name that is defined by the <literal>class</literal> keyword.
Each login is compared against a list of defined classes. The logged-in user
is considered a member of the first class matched.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>n</replaceable></term><listitem><para>Number of users.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>times</replaceable></term><listitem><para>Day-of-week and time-of-day when the class can connect. Use <literal>Any</literal> for any day.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>message-file</replaceable></term><listitem><para>Message file that is displayed if a user is denied access.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example><title>Setting User Login Limits</title><screen>limit   anon     50  Wk0800-1800		/etc/ftpd/ftpmsg.deny
limit   anon    100  Any				/etc/ftpd/ftpmsg.deny
limit   guest   100  Any				/etc/ftpd/ftpmsg.deny</screen><para>The first line of the preceding example shows a limit of 50 simultaneous
logins that are allowed to users of class <literal>anon</literal> during weekly
work hours. The second line limits <literal>anon</literal> users to 100 simultaneous
logins outside of working hours. The last line shows a limit of 100 <literal>guest</literal> logins that are allowed at any time. For information on how to
specify day and time parameters, see <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>.</para><para>The example further indicates that the content of the file <filename>/etc/ftpd/ftpmsg.deny</filename> is returned when a specified login limit is reached, assuming <filename>ftpmsg.deny</filename> exists. For information on using the <command>/usr/sbin/ftpcount</command> command to view the number and login limit for each class of user
who is logged in at a particular time, see <olink targetdoc="refman1" targetptr="ftpcount-1" remap="external"><citerefentry><refentrytitle>ftpcount</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>.</para><para>Users are allowed login to the FTP server unless a specified limit is
reached. Anonymous users are logged in as the user <literal>ftp</literal>.
 Real users are logged in as themselves, and guests are logged in as real
users with a <command>chroot</command> environment to limit access privileges.</para><para>For information on using the <command>/usr/sbin/ftpwho</command> command
to check the identities of the users logged into the FTP server, see <olink targetdoc="refman1" targetptr="ftpwho-1" remap="external"><citerefentry><refentrytitle>ftpwho</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>.</para>
</example>
</task><task id="wuftp-167"><title>How to Control the Number of Invalid Login Attempts</title><tasksummary><para>If a login to the FTP server fails because of a problem such as misspelling
required information, login is usually repeated. The user is allowed a specific
number of consecutive login attempts before a message is logged to the <filename>syslog</filename> file. At that point, the user is disconnected. You can set
a failure limit on the number of login attempts by following steps in the
next procedure.</para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-170"><para>Add the following entries to the <filename>ftpaccess</filename> file.</para><screen>loginfails <replaceable>n</replaceable></screen><variablelist><varlistentry><term>loginfails</term><listitem><para>Keyword that is used to assign the number of login failures
that are permitted before the FTP connection is terminated</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>n</replaceable></term><listitem><para>Number of times a login can fail</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example><title>Controlling the Number of Invalid Login Attempts</title><screen>loginfails 10</screen><para>The preceding example states that the user is disconnected from the
FTP server after 10 failed login attempts.</para>
</example>
</task><task id="wuftp-44a"><title>How to Disallow FTP Server Access to Particular
Users</title><tasksummary><para>The <filename>/etc/ftpd/ftpusers</filename> file lists names of users
who are not allowed to log in to the FTP server. When login is attempted,
the FTP server checks the <filename>/etc/ftpd/ftpusers</filename> file to
determine whether the user should be denied access. If the user's name is
not found in that file, the server then searches the <filename>/etc/ftpusers</filename> file. </para><para>If the user's name is matched in <filename>/etc/ftpusers</filename>,
a <filename>syslogd</filename> message is written with a statement that the
match was found in a deprecated file. The message also recommends the use
of <filename>/etc/ftpd/ftpusers</filename> instead of <filename>/etc/ftpusers</filename>.</para><note><para>Support for the <filename>/etc/ftpusers</filename> file has been
deprecated in this release. If the <filename>/etc/ftpusers</filename> file
exists when the FTP server is installed, the file is moved to <filename>/etc/ftpd/ftpusers</filename>.</para>
</note><para>For additional information, see <olink targetdoc="refman1m" targetptr="syslogd-1m" remap="external"><citerefentry><refentrytitle>syslogd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>, <olink targetdoc="refman1m" targetptr="in.ftpd-1m" remap="external"><citerefentry><refentrytitle>in.ftpd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>, and <olink targetdoc="refman4" targetptr="ftpusers-4" remap="external"><citerefentry><refentrytitle>ftpusers</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink></para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-158"><para>Add entries to the <filename>/etc/ftpd/ftpusers</filename> file
for users who are not allowed to log in to the FTP server.</para>
</step>
</procedure><example><title>How to Disallow FTP Server Access</title><screen>root
daemon
bin
sys
adm
lp
uccp
nuucp
listen
nobody
noaccess
nobody4</screen><para>The previous example lists the typical entries in the <filename>ftpusers</filename> file.
User names match entries in the <filename>/etc/passwd</filename>. The list
generally includes the <literal>root</literal> and other administrative and
system application identities.</para><para>The root entry is included in the <filename>ftpusers</filename> file
as a security measure. The default security policy is to disallow remote logins
for <literal>root</literal>. The policy is also followed for the default value
that is set as the CONSOLE entry in the <filename>/etc/default/loginfile</filename>.
See <olink targetdoc="refman1" targetptr="login-1" remap="external"><citerefentry><refentrytitle>login</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>.</para>
</example>
</task><task id="wuftp-51"><title>How to Restrict Access to the Default FTP Server</title><tasksummary><para>In addition to the controls mentioned previously, you can add explicit
statements to the <filename>ftpaccess</filename> file to restrict access to
the FTP server. </para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-54"><para>Add the following entries to the <filename>ftpaccess</filename> file.</para><substeps><step id="wuftp-step-162"><para>By default, all users are allowed access to
the default (non-virtual) FTP server. To deny access for specific users (other
than <literal>anonymous</literal>), add the following entry:</para><screen>defaultserver deny <replaceable>username</replaceable> [<replaceable>username...</replaceable>]</screen><variablelist><varlistentry><term><literal>defaultserver</literal></term><listitem><para>Keyword that is used to identify the non-virtual server to
which access can be denied or allowed</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>username</replaceable></term><listitem><para>Login name of a user with restricted access to the <literal>defaultserver</literal></para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="wuftp-step-161"><para>To allow access for users who are not listed
on the <literal>deny</literal> line, add the following line:</para><screen>defaultserver allow <replaceable>username</replaceable> [<replaceable>username...</replaceable>]</screen>
</step><step id="wuftp-step-149a"><para>To prevent access by anonymous users, add
the entry: </para><screen>defaultserver private</screen>
</step>
</substeps>
</step>
</procedure><example><title>Restricting Access to the Default FTP Server</title><screen>defaultserver deny *
defaultserver allow <replaceable>username</replaceable></screen><para>The previous example states that the FTP server denies access to all
users except <literal>anon</literal> users and those users who are listed
on the <literal>allow</literal> line.</para><para>You can also use the <filename>ftphosts</filename>  file to deny
access to particular login accounts from various hosts. See <olink targetdoc="refman4" targetptr="ftphosts-4" remap="external"><citerefentry><refentrytitle>ftphosts</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> for additional information.</para>
</example>
</task>
</sect1><sect1 id="wuftp-10"><title>Setting Up FTP Server Logins</title><para>To access an FTP server, you must first log in. The FTP server supports
three types of user login accounts for <emphasis>real</emphasis>, <emphasis>guests</emphasis>, and <emphasis>anonymous</emphasis> users.</para><itemizedlist><listitem override="bullet"><para><emphasis>Real</emphasis> users have accounts
that allow them to establish terminal sessions on systems that run the FTP
server. Subject to directory and file access permissions, the entire disk
structure is visible to real users.</para>
</listitem><listitem override="bullet"><para><emphasis>Guest</emphasis>  users also need
accounts to log in to the FTP server. Each guest account is set up with a
user name and password. Functioning login shells are not assigned to guests
to prevent users from establishing terminal sessions. At login, the FTP server
performs a <olink targetdoc="refman2" targetptr="chroot-2" remap="external"><citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry></olink> operation
to restrict a guest's view of the server's disk structure.</para><note><para>Login shells for real and guest users must be listed in the <filename>/etc/shells</filename> file to allow access to the FTP server.</para>
</note>
</listitem><listitem override="bullet"><para><emphasis>Anonymous</emphasis> users log
in to the FTP server by using the either <literal>ftp</literal> or <literal>anonymous</literal> as a user name. By convention, anonymous users supply an email
address when prompted for a password.</para><para>At login, the FTP server
performs a <olink targetdoc="refman2" targetptr="chroot-2" remap="external"><citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry></olink> operation
that restricts the anonymous user's view of the server's disk structure. A
single file area is shared by all anonymous users, unlike the separate areas
that can be created for each guest user.</para><para>Real and guest users
log in by using individual accounts with passwords that are known only to
one person. Anonymous users log in to a well-known account that is potentially
available to anyone. Most large-scale file distribution is created by using
the anonymous account.</para>
</listitem>
</itemizedlist><task id="wuftp-153"><title>How to Set Up Real FTP Users</title><tasksummary><para>To enable access for real users to the FTP server, follow these
instructions:</para>
</tasksummary><procedure><step id="wuftp-step-150"><para>Verify that the user has an account that is
set up with a user name and password that can be used to establish a terminal
session.</para><para>For more information, see <olink targetdoc="sysadv1" targetptr="userconcept-97366" remap="external">Chapter 4, <citetitle remap="chapter">Managing User Accounts and Groups (Overview),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</step><step id="wuftp-step-151"><para>Confirm that the real user is a member of
a class in the <filename>ftpaccess</filename> file.</para><para>For information
on the user classes that are defined in the <filename>ftpaccess</filename> file,
see <olink targetptr="wuftp-45" remap="internal">How to Define FTP Server Classes</olink>.</para>
</step><step id="wuftp-step-152"><para>Verify that the user's login shell is listed
in the <filename>/etc/shells</filename> file.</para>
</step>
</procedure>
</task><task id="wuftp-18"><title>How to Set Up Guest FTP Users</title><tasksummary><para>The <command>ftpconfig</command> script is used to copy all necessary
system files to the home directory. When the guest user and the guest's home
directory already exist, the <command>ftpconfig</command> script updates the
area with the current system files.</para><para>For more information, see <olink targetdoc="refman1m" targetptr="ftpconfig-1m" remap="external"><citerefentry><refentrytitle>ftpconfig</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para><note><para>Unlike the user name (<literal>anonymous</literal> or <literal>ftp</literal>)
that is set for anonymous users, user names for FTP guests are not fixed.
Any name that would work as a real user name can be selected.</para>
</note><para>To enable access by a guest user to the FTP server, do the following:</para>
</tasksummary><procedure><step id="wuftp-step-153"><para>Use the <filename>useradd</filename> script
to create a guest user account with a login shell of <filename>/bin/true</filename> and
a home directory of <filename><replaceable>/root-dir/./home-dir</replaceable></filename>. </para><para>For more information, see <olink targetdoc="refman1m" targetptr="useradd-1m" remap="external"><citerefentry><refentrytitle>useradd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> and <olink targetdoc="sysadv1" targetptr="userconcept-97366" remap="external">Chapter 4, <citetitle remap="chapter">Managing User Accounts and Groups (Overview),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para><note><para>In this procedure, <userinput>/home/guests/./guest1</userinput> is
used as the home directory name for a user who is called <literal>guest1</literal>.</para>
</note><screen># <userinput>/usr/sbin/useradd -m -c "Guest FTP" -d \</userinput>
  <userinput>/home/guests/./guest1 -s /bin/true guest1</userinput></screen>
</step><step id="wuftp-step-155"><para>Assign a password to the guest account.</para>
</step><step id="wuftp-step-156"><para>Add a <literal>guestuser</literal> entry to
the <filename>ftpaccess</filename> file.</para><screen>guestuser guest1</screen><note><para>You can also use the <literal>guestgroup</literal> capability
in the <filename>ftpaccess</filename> file to specify guest users. The <filename>guest-root</filename> capability in <filename>ftpaccess</filename> eliminates
the need for the <filename>/./</filename> in the guest user's home directory
path.</para>
</note>
</step><step id="wuftp-step-155gg"><para>Confirm that the guest user is a member
of a <literal>class</literal> in the <filename>ftpaccess</filename> file.
See <olink targetptr="wuftp-45" remap="internal">How to Define FTP Server Classes</olink> for
further information.</para>
</step><step id="wuftp-step-157"><para>Use the <filename>ftpconfig</filename> script
to create the required files in the <command>chroot</command> area.</para><screen><userinput>/usr/sbin/ftpconfig -d /home/guests</userinput></screen>
</step><step id="wuftp-step-156g"><para>Confirm that <filename>/bin/true</filename> is
listed in the <filename>/etc/shells</filename> file. See <olink targetptr="wuftp-18-a" remap="internal">How to Create the /etc/shells file</olink>.</para>
</step>
</procedure><example><title>Setting Up a Guest FTP Server</title><para>In this example, the FTP area is set up in the <filename>/home/guests</filename> directory.</para><screen># <userinput>/usr/sbin/ftpconfig -d /home/guests</userinput>
Updating directory /home/guests</screen>
</example>
</task><task id="wuftp-18g"><title>How to Set Up Anonymous FTP Users</title><tasksummary><para>The <filename>ftpconfig</filename> script creates the <literal>anonymous</literal> user account and populates the home directory with the required
files.</para><para>For more information, see <olink targetdoc="refman1m" targetptr="ftpconfig-1m" remap="external"><citerefentry><refentrytitle>ftpconfig</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><para>To enable access by an anonymous user to the FTP server, follow these
instructions:</para>
</tasksummary><procedure><step id="wuftp-step-153a"><para>Use the <filename>ftpconfig</filename> script
to create the anonymous user account. </para><screen>/usr/sbin/ftpconfig <replaceable>anonymous-ftp-directory</replaceable></screen>
</step><step id="wuftp-step-154a"><para>Confirm that the anonymous user is assigned
to a <literal>class</literal> in the <filename>ftpaccess</filename> file. </para><para>See <olink targetptr="wuftp-45" remap="internal">How to Define FTP Server Classes</olink> for
further information.</para>
</step>
</procedure><example><title>Setting Up Anonymous FTP Users</title><para>In this example, the FTP area is set up in the <filename>/home/ftp</filename> directory.</para><screen># <userinput>/usr/sbin/ftpconfig /home/ftp</userinput>
Creating user ftp
Updating directory /home/ftp</screen>
</example>
</task><task id="wuftp-18-a"><title>How to Create the <filename>/etc/shells</filename> file</title><procedure>&rolestepA;<step id="wuftp-step-18a2"><para>Create the <filename>/etc/shells</filename> file.</para>
</step><step id="wuftp-step-18a2a"><para>Edit <filename>/etc/shells</filename>. Add
the full path to each shell on a single line.</para>
</step>
</procedure><example><title>Creating the /etc/shells file</title><para>The following is an example of an <filename>/etc/shells</filename> file
with a <filename>/bin/true</filename> listed for FTP guest users:</para><screen>/sbin/sh 
/bin/csh 
/bin/jsh 
/bin/ksh 
/bin/remsh 
/bin/rksh 
/bin/rsh 
/bin/sh 
/usr/bin/csh 
/usr/bin/ksh 
/usr/bin/bash 
/usr/bin/tcsh
/usr/bin/zsh 
/bin/true</screen>
</example>
</task>
</sect1><sect1 id="wuftp-29"><title>Customizing Message Files</title><para>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.</para><para>In addition to plain text, message files can contain one or more <firstterm>magic cookies</firstterm>. A magic cookie is composed of a <literal>%</literal> (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.</para><para>For example, message text might contain the cookie <literal>%L</literal>:</para><screen>Welcome to %L! </screen><para>When the message is displayed, the magic cookie <literal>%L</literal> is
replaced with the name of the server as defined by the <literal>hostname</literal> statement
in the <filename>ftpaccess</filename> file. For a complete list of supported
message cookies, see <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>.</para><note><para>If the host name is not defined in the <filename>ftpaccess</filename> file,
the default host name for the local machine is used.</para>
</note><task id="wuftp-31"><title>How to Customize Message Files</title><procedure>&rolestepA;<step id="wuftp-step-34"><para>Edit your message file to include magic cookies
as appropriate. </para><para>See <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> for a list of cookies you
can use.</para>
</step>
</procedure><example><title>Customizing Message Files</title><para>The following is an example of a message file that includes magic cookies:</para><screen>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.</screen>
</example>
</task><task id="wuftp-37"><title>How to Create Messages to Be Sent to Users</title><tasksummary><para>After the user is logged in, system-related or application-related messages
are displayed on screen. The <filename>ftpaccess</filename> file lists the
events that trigger associated <literal>message</literal> statements.</para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-40"><para>Add the following entries to the <filename>ftpaccess</filename> file:</para><screen>message <replaceable>message-file</replaceable> [<replaceable>when</replaceable> [<replaceable>class ...</replaceable>]]</screen><variablelist><varlistentry><term><literal>message</literal></term><listitem><para>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.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>message-file</replaceable></term><listitem><para>Name of the message file to be displayed.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>when</replaceable></term><listitem><para>Parameter that is set as <command>login</command> or <command>cwd=</command><replaceable>dir</replaceable>. See the following example.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>class</replaceable></term><listitem><para>The <literal>class</literal> specification allows the message
to be displayed only to members of a particular class.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example><title>Creating Messages to Be Sent to Users</title><screen>message	/etc/ftpd/Welcome	login   anon guest
message	.message	cwd=*  </screen><para>The preceding example states that the file <filename>/etc/ftpd/Welcome</filename> is
displayed at login for users of the class <literal>anon</literal> or <literal>guest</literal>. The second line states that the <filename>.message</filename> file
in the current working directory is displayed for all users.</para><para>Message files are created relative to the <command>chroot</command> directory
for guest and anonymous users.</para>
</example>
</task><task id="wuftp-79"><title>How to Configure the README Option</title><tasksummary><para>The first time a directory is visited, <filename>README</filename> files
can be listed. To configure the README option, add the following entries to
the <filename>ftpaccess</filename> file.</para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-82"><para>Add the following entries to the <command>ftpaccess</command> file.</para><screen>readme <replaceable>message-file</replaceable> [when [<replaceable>class</replaceable>...]]</screen><variablelist><varlistentry><term><literal>readme</literal></term><listitem><para>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.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>message-file</replaceable></term><listitem><para>Name of the message file to be checked.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>when</replaceable></term><listitem><para>Parameter that is set as <command>login</command> or <command>cwd=</command><replaceable>dir</replaceable>. See the following example.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>class</replaceable></term><listitem><para>The <literal>class</literal> specification allows the message
to be displayed only to members of a particular class.</para>
</listitem>
</varlistentry>
</variablelist><note><para>The <literal>greeting</literal> and <literal>banner</literal> keywords
can also be used to send messages to users. See <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>.</para>
</note>
</step>
</procedure><example><title>Configuring the README Option</title><screen>readme  README*     login
readme  README*     cwd=*  </screen><para>The previous example states that any files that match <filename>README*</filename> 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.</para><screen>% <userinput>ftp earth</userinput>
Connected to earth.
220 earth FTP server ready.
Name (earth:rimmer): <userinput>ftp</userinput>
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> <userinput>cd pub</userinput>
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> <userinput>get README /tmp/README</userinput>
200 PORT command successful.
150 Opening ASCII mode data connection for README (0 
bytes).
226 ASCII Transfer complete.
ftp> <userinput>quit</userinput>
221 Goodbye.
 </screen>
</example>
</task>
</sect1><sect1 id="wuftp-14"><title>Controlling Access to Files on the FTP Server</title><para>The FTP server access controls in this section supplement the standard
file and directory access controls available with the Solaris release. Use
the standard Solaris commands to restrict who can access, change, or upload
files. See <olink targetdoc="refman1" targetptr="chmod-1" remap="external"><citerefentry><refentrytitle>chmod</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>, <olink targetdoc="refman1" targetptr="chown-1" remap="external"><citerefentry><refentrytitle>chown</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>, and <olink targetdoc="refman1" targetptr="chgrp-1" remap="external"><citerefentry><refentrytitle>chgrp</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>.</para><task id="wuftp-63a"><title>How to Control File Access Commands</title><tasksummary><para>To use the permission capabilities in <filename>ftpaccess</filename> to
specify what type of user is allowed to perform which commands, do the following:</para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-66a"><para>Add the following entries to the <filename>ftpaccess</filename>:</para><screen><replaceable>command</replaceable> <literal>yes|no</literal> <replaceable>typelist</replaceable></screen><variablelist><varlistentry><term><replaceable>command</replaceable></term><listitem><para>The commands <command>chmod</command>, <command>delete</command>, <command>overwrite</command>, <command>rename</command>, or <command>umask</command></para>
</listitem>
</varlistentry><varlistentry><term><literal>yes|no</literal></term><listitem><para>Allows or disallows a user to issue a command</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>typelist</replaceable></term><listitem><para>A comma-separated list of any of the keywords <literal>anonymous</literal>, <literal>guest</literal>, and <literal>real</literal></para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example><title>How to Control File Access Commands</title><para>The following are examples of permissions that are set for file access
functions on FTP server.</para><screen>chmod no anonymous, guest
delete    no anonymous
overwrite no anonymous
rename    no anonymous
umask     no guest, anonymous</screen><itemizedlist><para>The preceding example states the following:</para><listitem override="bullet"><para>Anonymous users are not allowed to delete,
overwrite, or rename files.</para>
</listitem><listitem override="bullet"><para>Guests and anonymous users are both prevented
from changing access modes and resetting the umask.</para>
</listitem>
</itemizedlist>
</example>
</task>
</sect1><sect1 id="wuftp-15"><title>Controlling Uploads and Downloads on the FTP Server</title><para>You can control uploads and downloads that are started to and from the
FTP server by setting permissions on directories on the server. By default,
uploads are not allowed for anonymous users. Be very careful when enabling
anonymous uploads.</para><task id="wuftp-85"><title>How to Control Uploads to the FTP Server</title><tasksummary><para>Add the directives to the <filename>ftpaccess</filename> file to specify
upload permissions and error messages for upload failures.</para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-88"><para>Add the following entries to the <filename>ftpaccess</filename> file.</para><para>To enable users to upload files, add the following
entry:</para><screen>upload [absolute|relative] [class=&lt;classname>]... [-] <replaceable>root-dir</replaceable> \
<replaceable>dirglob</replaceable> yes|no <replaceable>owner</replaceable> <replaceable>group</replaceable> <replaceable>mode</replaceable> [dirs|nodirs] [&lt;d_mode>]

path-filter <replaceable>typelist</replaceable> <replaceable>mesg</replaceable> <replaceable>allowed-charset {disallowed regexp...}</replaceable></screen><variablelist><varlistentry><term><literal>upload</literal></term><listitem><para>Keyword that is applied to users who have a home directory
(the argument to <function>chroot</function>) of the <replaceable>root-dir</replaceable>.
The <replaceable>root-dir</replaceable>  can be specified as  &ldquo;*&rdquo;
to match any home directory.</para>
</listitem>
</varlistentry><varlistentry><term><literal>absolute|relative</literal></term><listitem><para>Parameter that specifies whether the <replaceable>root-dir</replaceable> 
directory paths are interpreted as absolute or relative to the current <command>chroot</command> directory.</para>
</listitem>
</varlistentry><varlistentry><term><literal>class</literal></term><listitem><para>Keyword that is used to specify any number of <literal>class=&lt;classname></literal> restrictions. If restrictions are specified, the upload clause
only becomes effective if the current user is a member of one of the specified
classes.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>root-dir</replaceable></term><listitem><para>User's root directory and the home directory for anonymous
users.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>dirglob</replaceable></term><listitem><para>A pattern to match a directory name. An asterisk can be used
in any place or alone to signify any directory. </para>
</listitem>
</varlistentry><varlistentry><term><literal>yes|no</literal></term><listitem><para>Variable that allows or disallows upload to the FTP server.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>owner</replaceable></term><listitem><para>Owner of files that are uploaded into <filename>dirnames</filename>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>group</replaceable></term><listitem><para>Group that is associated with files that are uploaded into <filename>dirnames</filename>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>mode</replaceable></term><listitem><para>Parameter that is used to specify access permissions for uploaded
files. The default mode <literal>0440</literal> prevents the anonymous account
from reading uploaded files.</para>
</listitem>
</varlistentry><varlistentry><term><literal>dirs|nodirs</literal></term><listitem><para>Keyword that allows or disallows users to create subdirectories
in a directory that is listed in <filename>dirnames</filename>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>d_mode</literal></term><listitem><para>Optional mode that determines the permissions for a newly
created directory.</para>
</listitem>
</varlistentry><varlistentry><term><literal>path-filter</literal></term><listitem><para>Keyword that controls the names of uploaded files.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>typelist</replaceable></term><listitem><para>A comma-separated list of any of the keywords <literal>anonymous</literal>, <literal>guest</literal>, and <literal>real</literal>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>mesg</replaceable></term><listitem><para>Message file that is displayed fails to match the <literal>regexp</literal> criteria.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>allowed-charset {disallowed regexp...}</replaceable></term><listitem><para>Alphanumeric characters allowed or disallowed in file names.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example><title>Controlling Uploads to the FTP Server</title><screen>upload /export/home/ftp /incoming yes ftpadm ftpadmin 0440 nodirs
path-filter anonymous /etc/ftpd/filename.msg ^[-A-Za-z0-9._]*$ ^[.-]</screen><itemizedlist><para>The preceding example states the following:</para><listitem override="bullet"><para>FTP user accounts that use <command>chroot</command> to <filename>/export/home/ftp</filename> can upload to the <filename>/incoming</filename> directory.
Uploaded files are owned by user <literal>ftpadm</literal> and the group <literal>ftpadmin</literal>. The mode is set to <literal>0440</literal> with the <literal>nodirs</literal> keyword to prevent anonymous users from creating subdirectories.</para>
</listitem><listitem override="bullet"><para>For anonymous users, a file name is any
sequence of A-Z, a-z, 0-9, . (dot), - (dash), or _ (underline). File names
cannot start with a . (dot) or - (dash). If a file name fails this filter,
the <filename>/etc/ftpd/filename.msg</filename> message is displayed if the
FTP Administrator has created the message file. This message is followed by
an FTP server error message.</para>
</listitem>
</itemizedlist><para>Ownership
and permissions on a directory into which anonymous uploads are allowed should
be tightly controlled. The FTP Administrator should be the owner of all files
uploaded to the FTP server. You need to create an FTP Administrator when anonymous
users are allowed to upload files. The directory should be owned by the user <literal>ftpadm</literal> and group <literal>ftpadm</literal> with permissions set
to <literal>3773</literal>.</para><para>The access mode for files uploaded to the FTP server should be <literal>0440</literal>. The <literal>0440</literal> mode prevents the anonymous account
from reading uploaded files. This restriction protects your server from becoming
a staging area for third-party file distribution.</para><para>To make uploaded files available for distribution, the FTP Administrator
can move files to a public directory.</para>
</example>
</task><task id="wuftp-173"><title>How to Control Downloads to the FTP Server</title><procedure>&rolestepA;<step id="wuftp-step-176"><para>Add the following entries to the <filename>ftpaccess</filename> file to prevent users from retrieving files.</para><screen>noretrieve [absolute|relative] [class=<replaceable>classname]...</replaceable> [-] <replaceable>filename ...</replaceable></screen><variablelist><varlistentry><term><literal>noretrieve</literal></term><listitem><para>Keyword that is used to deny retrieval of a particular file
or files</para>
</listitem>
</varlistentry><varlistentry><term><literal>absolute|relative</literal></term><listitem><para>Parameter that specifies whether the <replaceable>root-dir</replaceable> 
directory paths are interpreted as absolute or relative to the current <command>chroot</command> directory</para>
</listitem>
</varlistentry><varlistentry><term><literal>class</literal></term><listitem><para>Keyword that is used to specify <literal>class=&lt;classname></literal> of
users to which <literal>noretrieve</literal> restrictions apply </para>
</listitem>
</varlistentry><varlistentry><term><replaceable>filename</replaceable></term><listitem><para>Name of file the user is not permitted to retrieve</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example><title>Controlling Downloads to the FTP Server</title><screen>noretrieve /etc/passwd</screen><para>The preceding example states that all users are prevented from retrieving
the <filename>/etc/passwd</filename> file.</para>
</example>
</task>
</sect1><sect1 id="wuftp-15a2"><title>Virtual Hosting</title><para>Virtual hosting allows the FTP server to support multiple domains on
the same machine. Each virtual host requires a separate logical interface
and IP address.</para><para>The FTP server supports two types of virtual hosting: <emphasis>limited</emphasis> and <emphasis>complete</emphasis>. With limited virtual hosting, the same configuration
files are used for all virtual hosts. With complete virtual hosting, separate
configuration files can be used for each virtual host.</para><note><para>By default, real and guest users are not allowed to log in to
virtual hosts. You can set the following <filename>ftpaccess</filename> directives
to override the default.</para><screen>To allow access to specific users:
virtual <replaceable>address</replaceable> allow <replaceable>username</replaceable>
To deny access to anonymous users:
virtual <replaceable>address</replaceable> private <replaceable>username</replaceable></screen>
</note><para>See <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> for
further information.</para><task id="wuftp-179"><title>How to Enable Limited Virtual Hosting</title><tasksummary><itemizedlist><para>Limited virtual hosting provides partial support for virtual FTP servers.
You can enable support for limited virtual hosting by specifying the virtual
root directory. If required, you can also set the following parameters for
the virtual host in the <filename>ftpaccess</filename> file:</para><listitem override="dash"><para><literal>banner</literal></para>
</listitem><listitem override="dash"><para><literal>logfile</literal></para>
</listitem><listitem override="dash"><para><literal>email</literal></para>
</listitem><listitem override="dash"><para><literal>hostname</literal></para>
</listitem>
</itemizedlist><para>All directives in the <filename>ftpaccess</filename> file are shared
globally across all virtual servers.</para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-182"><para>Add the following entries to the <filename>ftpaccess</filename> file.</para><screen>virtual <replaceable>address</replaceable> root|banner|logfile <replaceable>path</replaceable>
virtual <replaceable>address</replaceable> hostname|email <replaceable>string</replaceable></screen><variablelist><varlistentry><term><literal>virtual</literal></term><listitem><para>Keyword that is used to enable virtual server capabilities</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>address</replaceable></term><listitem><para>IP address of the virtual server</para>
</listitem>
</varlistentry><varlistentry><term><literal>root</literal></term><listitem><para>The root directory of the virtual server</para>
</listitem>
</varlistentry><varlistentry><term><literal>banner</literal></term><listitem><para>Banner file that is displayed when a connection is made to
the virtual server</para>
</listitem>
</varlistentry><varlistentry><term><literal>logfile</literal></term><listitem><para>Record of file transfers that are made to and from the virtual
server</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>path</replaceable></term><listitem><para>Variable that is used to specify the location of directories
and files on the virtual server</para>
</listitem>
</varlistentry><varlistentry><term><literal>email</literal></term><listitem><para>Email address that is used in message files and in the <command>HELP</command> command</para>
</listitem>
</varlistentry><varlistentry><term><literal>hostname</literal></term><listitem><para>Name of the host that is shown in the greeting message or
status command</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>string</replaceable></term><listitem><para>Variable that is used to specify <literal>email</literal> or <literal>hostname</literal> parameters</para>
</listitem>
</varlistentry>
</variablelist><note><para>While it is possible to use <literal>hostname</literal> as the <replaceable>address</replaceable> of the virtual server, you are strongly encouraged to
use the IPv4 address instead. DNS must be available when the FTP connection
is received in order for <literal>hostname</literal> to be matched. For an
IPv6 host, use the host name rather than the IPv6 address.</para>
</note>
</step>
</procedure><example><title>Enabling Limited Virtual Hosting in the <filename>ftpaccess</filename> File</title><screen>virtual 10.1.2.3 root    /var/ftp/virtual/ftp-serv
virtual 10.1.2.3 banner  /var/ftp/virtual/ftp-serv/banner.msg
virtual 10.1.2.3 logfile /var/log/ftp/virtual/ftp-serv/xferlog</screen><para>The preceding example sets the location of the <literal>root</literal> directory, <literal>banner</literal>, and <literal>logfile</literal> on a virtual FTP server.</para>
</example><example id="egkcd"><title>Enabling Limited Virtual Hosting on the Command Line</title><para>The <olink targetdoc="refman1m" targetptr="ftpaddhost-1m" remap="external"><citerefentry><refentrytitle>ftpaddhost</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> script with the <option>l</option> option is provided
to configure limited virtual hosts.</para><para>In the following example, <command>ftpaddhost</command> is run with <option>l</option> <option>b</option> <option>x</option> options to configure limited
virtual hosting with a test banner and the logfile <filename>/var/ftp/virtual/10.1.2.3/xferlog</filename> under a virtual root <filename>/var/ftp/virtual/10.1.2.3</filename>.</para><screen># <userinput>ftpaddhost -l -b -x /var/ftp/virtual/10.1.2.3/xferlog</userinput> \
<userinput>/var/ftp/virtual/10.1.2.3</userinput></screen>
</example>
</task><task id="wuftp-184"><title>How to Enable Complete Virtual Hosting</title><tasksummary><itemizedlist><para>Complete virtual hosting allows separate configuration files for each
virtual domain. To enable complete support for virtual hosting on the FTP
server, you can create or modify the following FTP configuration files for
specific domains: </para><listitem override="dash"><para><filename>ftpaccess</filename></para>
</listitem><listitem override="dash"><para><filename>ftpusers</filename></para>
</listitem><listitem override="dash"><para><filename>ftpgroups</filename></para>
</listitem><listitem override="dash"><para><filename>ftphosts</filename></para>
</listitem><listitem override="dash"><para><filename>ftpconversions</filename></para>
</listitem>
</itemizedlist><para>For further information, see <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, <olink targetdoc="refman4" targetptr="ftpusers-4" remap="external"><citerefentry><refentrytitle>ftpusers</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, <olink targetdoc="refman4" targetptr="ftpgroups-4" remap="external"><citerefentry><refentrytitle>ftpgroups</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, <olink targetdoc="refman4" targetptr="ftphosts-4" remap="external"><citerefentry><refentrytitle>ftphosts</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, and <olink targetdoc="refman4" targetptr="ftpconversions-4" remap="external"><citerefentry><refentrytitle>ftpconversions</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>.</para><note><para>If separate versions of the configuration files are unavailable,
master versions of the files in the <filename>/etc/ftpd</filename> directory
are used.</para>
</note>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-187"><para>Add the following entry to the <filename>/etc/ftpd/ftpservers</filename> file.</para><screen><replaceable>address</replaceable> /<replaceable>config-file-dir</replaceable></screen><variablelist><varlistentry><term><replaceable>address</replaceable></term><listitem><para>IP address of the virtual server</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>config-file-dir</replaceable></term><listitem><para>Directory that contains the configuration files that are customized
for the virtual host</para>
</listitem>
</varlistentry>
</variablelist><note><para>While it is possible to use <literal>hostname</literal> as the <replaceable>address</replaceable> of the virtual server, you are strongly encouraged to
use the IPv4 address instead. DNS must be available when the FTP connection
is received in order for <literal>hostname</literal> to be matched. For an
IPv6 host, use the host name rather than the IPv6 address.</para>
</note>
</step><step id="wuftp-step-230"><para>To create a customized version of an FTP server
configuration file for the virtual host, copy the master version of the file
from <filename>/etc/ftpd</filename> to the <filename>/config-file-dir</filename> directory.</para><para>For further information, see <olink targetdoc="refman4" targetptr="ftpservers-4" remap="external"><citerefentry><refentrytitle>ftpservers</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>.</para>
</step>
</procedure><example><title>Enabling Complete Virtual Hosting in the <filename>ftpservers</filename> file</title><screen>#
# FTP Server virtual hosting configuration file
#

10.1.2.3 /net/inet/virtual/somedomain/
10.1.2.4 /net/inet/virtual/anotherdomain/</screen><para>The preceding example specifies the IP addresses for two different domains
on the virtual server.</para>
</example><example id="egkax"><title>Enabling Complete Virtual Hosting from the Command Line</title><para>The <olink targetdoc="refman1m" targetptr="ftpaddhost-1m" remap="external"><citerefentry><refentrytitle>ftpaddhost</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> script with the <option>c</option> option is provided
to configure complete virtual hosts.</para><para>In the following example, <command>ftpaddhost</command> is run with <option>c</option> <option>b</option> <option>x</option> options to configure complete
virtual hosting with a test banner and the logfile <filename>/var/ftp/virtual/10.1.2.3/xferlog</filename> under a virtual root <filename>/var/ftp/virtual/10.1.2.3</filename>.</para><screen># <userinput>ftpaddhost -c -b -x /var/ftp/virtual/10.1.2.3/xferlog</userinput> \
<userinput>/var/ftp/virtual/10.1.2.3</userinput></screen>
</example>
</task>
</sect1><sect1 id="wuftp-189"><title>Starting the FTP Server Automatically</title><itemizedlist><para>The FTP server can be started in one of three ways:</para><listitem override="bullet"><para>As a <literal>nowait</literal> server that is started by <command>inetd</command></para>
</listitem><listitem override="bullet"><para>As a standalone server run in the background</para>
</listitem><listitem><para>As a standalone server run in the foreground from the <filename>inittab</filename> file</para>
</listitem>
</itemizedlist><para>A standalone server always has the quickest possible response time,
and is intended for large servers that are dedicated to providing FTP service.
The standalone server provides low connection latency for dedicated servers
because the standalone system never has to be restarted. The standalone server
is always running, even during off-peak hours, waiting indefinitely
for connections.</para><task id="wuftp-191"><title>How to Start an FTP Server Using SMF</title><tasksummary><para>By default, the SMF service is configured to start the FTP server using
the <literal>nowait</literal> mode. If the site handles many connections,
the FTP server can also be run in standalone mode. See the <olink targetdoc="refman1m" targetptr="in.ftpd-1m" remap="external"><citerefentry><refentrytitle>in.ftpd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page for information
on additional command-line options. </para>
</tasksummary><procedure>&rolestepA;<step><para>Verify the <literal>wait</literal> property for the FTP server.</para><para>The line reporting that <literal>wait=FALSE</literal> indicates that
the server is started in <literal>nowait</literal> mode.</para><screen># <userinput>inetadm -l network/ftp</userinput>
SCOPE    NAME=VALUE
         name="ftp"
         endpoint_type="stream"
         proto="tcp6"
         isrpc=FALSE
         <userinput>wait=FALSE</userinput>
         exec="/usr/sbin/in.ftpd -a"
         user="root"
default  bind_addr=""
default  bind_fail_max=-1
default  bind_fail_interval=-1
default  max_con_rate=-1
default  max_copies=-1
default  con_rate_offline=-1
default  failrate_cnt=40
default  failrate_interval=60
default  inherit_env=TRUE
default  tcp_trace=FALSE
default  tcp_wrappers=FALSE</screen>
</step><step><para>Start the FTP server.</para><screen># <userinput>svcadm enable network/ftp</userinput></screen>
</step>
</procedure>
</task><task id="wuftp-197"><title>How to Start a Standalone FTP Server in the Background</title><procedure>&rolestepA;<step><para>Disable the FTP server.</para><screen># <userinput>svcadm disable network/ftp</userinput></screen>
</step><step><para>Start the standalone FTP server.</para><screen># <userinput>/usr/sbin/in.ftpd -a -S</userinput></screen><para>Add the line to an FTP server startup script. See <olink targetdoc="sysadv1" targetptr="fahqr" remap="external"><citetitle remap="section">Using Run Control Scripts</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink> for information on creating
a system startup script.</para>
</step>
</procedure>
</task><task id="egcoo"><title>How to Start a Standalone FTP Server in the Foreground</title><procedure>&rolestepA;<step><para>Disable the FTP server.</para><screen># <userinput>svcadm disable network/ftp</userinput></screen>
</step><step id="egcol"><para>Add an entry to the <filename>inittab</filename> file
to start the service.</para><para>The new entry in <filename>/etc/inittab</filename> should
look something like the following:</para><screen><userinput>ftpd:3:respawn:/usr/sbin/in.ftpd -a -s</userinput></screen>
</step><step><para>Tell <command>init</command> to re-examine <filename>/etc/inittab</filename>.</para><para>This command should start the FTP service.</para><screen># <userinput>init q</userinput></screen>
</step>
</procedure>
</task>
</sect1><sect1 id="wuftp-203"><title>Shutting Down the FTP Server</title><para>The <olink targetdoc="refman1m" targetptr="ftpshut-1m" remap="external"><citerefentry><refentrytitle>ftpshut</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> command
closes down the FTP server at a particular time.</para><para>When you run <command>ftpshut</command>, a file is generated from command-line
options that specify when shutdown occurs, the point at which new connections
are refused, and when existing connections are dropped. Users are notified
of a server shutdown based on this information. The location of the file that
is created by <command>ftpshut</command> is specified by the <literal>shutdown</literal> directive
in the <filename>ftpaccess</filename> file.</para><task id="wuftp-204"><title>How to Shut Down the FTP Server</title><tasksummary><para>Follow the steps in this procedure to run <command>ftpshut</command> and
to add the <literal>shutdown</literal> directive to the <filename>ftpaccess</filename> file.</para>
</tasksummary><procedure>&rolestepA;<step id="wuftp-step-208"><para>Add the following entries to the <filename>ftpaccess</filename> file.</para><screen>shutdown <replaceable>path</replaceable></screen><variablelist><varlistentry><term><literal>shutdown</literal></term><listitem><para>Keyword that is used to specify the <replaceable>path</replaceable> to
a file that is checked regularly for whether the FTP server is scheduled to
be shut down </para>
</listitem>
</varlistentry><varlistentry><term><replaceable>path</replaceable></term><listitem><para>Location of the file that was created by <command>ftpshut</command> command</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="wuftp-step-207"><para>Run the <command>ftpshut</command> command.</para><screen>ftpshut [ -V ] [ -l min] [ -d min] time [warning-message...]</screen><variablelist><varlistentry><term><command>ftpshut</command></term><listitem><para>Command that provides a procedure for notifying users that
the FTP server is shutting down.</para>
</listitem>
</varlistentry><varlistentry><term><literal>-V</literal></term><listitem><para>Option that is specified to display copyright and version
information, then terminate</para>
</listitem>
</varlistentry><varlistentry><term><literal>-l</literal></term><listitem><para>Flag that is used to adjust the time that new connections
to the FTP server are denied</para>
</listitem>
</varlistentry><varlistentry><term><literal>-d</literal></term><listitem><para>Flag that is used to adjust the time that existing connections
to the FTP server are disconnected.</para>
</listitem>
</varlistentry><varlistentry><term><literal>time</literal></term><listitem><para>Shutdown time that is specified by the word <literal>now</literal> for
immediate shutdown, or in one of two formats (+ <replaceable>number</replaceable> or <replaceable>HHMM</replaceable>) for a future shutdown</para>
</listitem>
</varlistentry><varlistentry><term><literal>[warning-message...]</literal></term><listitem><para>Shutdown notification message</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="wuftp-step-209"><para>Use the <command>ftprestart</command> command
to restart the FTP server after shutdown.</para><para>For further information,
see <olink targetdoc="refman1m" targetptr="ftpshut-1m" remap="external"><citerefentry><refentrytitle>ftpshut</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>, <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, and <olink targetdoc="refman1m" targetptr="ftprestart-1m" remap="external"><citerefentry><refentrytitle>ftprestart</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para>
</step>
</procedure>
</task>
</sect1><sect1 id="wuftp-210"><title>Debugging the FTP Server</title><para>This section describes some of the ways to debug problems with the FTP
server.</para><task id="wuftp-proc-221"><title>How to Check <filename>syslogd</filename> for
FTP Server Messages</title><tasksummary><para>The FTP server writes messages that are useful for debugging to the
location that is specified for daemon messages in the <filename>/etc/syslog.conf</filename> file.
If a problem occurs with the FTP server, check this file first for such messages.</para><para>The FTP server messages are controlled by facility daemon and level
information. To send messages from the FTP server to <filename>/var/adm/message</filename> and
have <filename>syslogd</filename> reread its configuration file, follow these
instructions:</para>
</tasksummary><procedure><step id="wuftp-step-222"><para>Add an entry such as the following to the <filename>/etc/syslog.conf</filename> file.</para><screen>daemon.info /var/adm/message</screen>
</step><step id="wuftp-step-223"><para>Signal <filename>syslogd</filename> to reread
its configuration.</para><screen># <userinput>svcadm refresh system/system-log</userinput></screen><para>This action causes informational messages from the FTP Sever to be written
to <filename>/var/adm/messages</filename>.</para>
</step>
</procedure>
</task><task id="wuftp-proc-211"><title>How to Use <literal>greeting text</literal> to
Verify <filename>ftpaccess</filename></title><tasksummary><para>To use the <literal>greeting text</literal> capability to check that
the correct <filename>ftpaccess</filename> file is being used, do the following:</para>
</tasksummary><procedure><step id="wuftp-step-212"><para>Add the following directive to the ftpaccess
file.</para><screen>greeting text <replaceable>message</replaceable></screen>
</step><step id="wuftp-step-213"><para>Connect to the FTP server.</para>
</step><step id="wuftp-step-214"><para>If the message fails to appear, do the following:</para><substeps><step id="wuftp-step-215"><para>Confirm that the <filename>ftpaccess</filename> file
is in the correct location. Use the <olink targetdoc="refman1" targetptr="strings-1" remap="external"><citerefentry><refentrytitle>strings</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> command to obtain the location
of the file from the FTP server binary.</para><screen># strings /usr/sbin/in.ftpd | grep "^/.*ftpaccess"</screen>
</step><step id="wuftp-step-216"><para>Check the <filename>ftpservers</filename> file
to see if virtual hosting has been configured.</para><para>For further information,
see <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, <olink targetdoc="refman4" targetptr="ftpservers-4" remap="external"><citerefentry><refentrytitle>ftpservers</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, <olink targetdoc="refman1" targetptr="strings-1" remap="external"><citerefentry><refentrytitle>strings</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>, <olink targetdoc="refman4" targetptr="syslog.conf-4" remap="external"><citerefentry><refentrytitle>syslog.conf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, and <olink targetdoc="refman1" targetptr="pgrep-1" remap="external"><citerefentry><refentrytitle>pgrep</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>.</para>
</step>
</substeps>
</step>
</procedure>
</task><task id="wuftp-proc-217"><title>How to Check the Commands Executed by FTP
Users</title><tasksummary><para>To see what commands are being executed by FTP users, use the <literal>log
commands</literal> logging capability in <filename>ftpaccess</filename>.</para>
</tasksummary><procedure><step id="wuftp-step-218"><para>Add the following directive to the <filename>ftpaccess</filename> file to log individual commands by users who are specified in <replaceable>typelist</replaceable>.</para><screen>log commands <replaceable>typelist</replaceable></screen>
</step><step id="wuftp-step-226a"><para>Check messages that are written to the location
specified in the <filename>/etc/syslog.conf</filename>.</para>
</step>
</procedure>
</task>
</sect1><sect1 id="egcom"><title>Configuration Help for Busy Sites</title><para>The following list includes some suggestions to improve performance
on busy FTP sites.</para><orderedlist><listitem><para>Sites which typically support many simultaneous connections
should run the FTP server in standalone mode, see <olink targetptr="wuftp-189" remap="internal">Starting
the FTP Server Automatically</olink>.</para>
</listitem><listitem><para>Use <command>vmstat</command> and other system utilities to
monitor the system hosting the FTP server. If the system runs low on resources
place a limit on the number of simultaneous connections, see <olink targetptr="wuftp-162" remap="internal">How to Set User Login Limits</olink>. For more information
on system monitoring, see <olink targetdoc="sysadv2" targetptr="spmonitor-24844" remap="external">Chapter 20, <citetitle remap="chapter">Monitoring System Performance (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Advanced Administration</citetitle></olink>.</para>
</listitem><listitem><para>If you impose a connection limit, consider using the <literal>limit-time</literal> and <literal>timeout idle</literal> capabilities in the <filename>ftpaccess</filename> file to stop users from hogging connections. If you don't impose
a connection limit, specify the <option>Q</option> option to <command>in.ftpd</command>.</para>
</listitem><listitem><para>If you don't need ftp login and logout records in <filename>/var/adm/wtmpx</filename>, specify the <option>W</option> option to <command>in.ftpd</command>.</para>
</listitem><listitem><para>To reduce the load on the system hosting the FTP server, increase
the transfer buffer sizes using the <literal>recvbuf</literal> and <literal>sendbuf</literal> capabilities in the <filename>ftpaccess</filename> file. If large
buffer sizes are selected it may be necessary to increase the data activity
timeout using the <literal>timeout data</literal> capability in the <filename>ftpaccess</filename> file.</para>
</listitem><listitem><para>The FTP server reads from various databases including the
hosts, passwd, group and services. Slow lookups may cause a significant delay
logging into the FTP server, configuring the <literal>files</literal> source
first in <filename>nsswitch.conf</filename> minimizes the lookup times. For
more information, see the <olink targetdoc="refman4" targetptr="nsswitch.conf-4" remap="external"><citerefentry><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page.</para>
</listitem><listitem><para>By default the FTP server attempts to lookup the remote host's
name, which can be slow causing a significant delay logging in. The <literal>rhostlookup</literal> capability in the <literal>ftpaccess</literal> file can be used
to stop this lookup. However be aware that if the remote host's name is not
looked up, only its IP address is matched when using other capabilities in
the <filename>ftpaccess</filename> file and when matching entries in the <filename>ftphosts</filename> file. Also the remote host's IP address will be used in
messages and in place of the %R magic cookie. See the description of the <literal>rhostlookup</literal> capability in the <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page for more details.</para>
</listitem><listitem><para>Retrieving quota information may also cause a significant
delay when logging into the FTP server, so only use the <literal>quota-info</literal> capability
in the <filename>ftpaccess</filename> file if you make use of the quota magic
cookies. See the <olink targetdoc="refman4" targetptr="ftpaccess-4" remap="external"><citerefentry><refentrytitle>ftpaccess</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page for a list of the quota magic cookies.</para>
</listitem>
</orderedlist>
</sect1>
</chapter>