<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;

  <!ENTITY vsftpd-download-http "https://security.appspot.com/downloads/vsftpd-&vsftpd-version;.tar.gz">
  <!ENTITY vsftpd-download-ftp  " ">
  <!ENTITY vsftpd-md5sum        "8b00c749719089401315bd3c44dddbb2">
  <!ENTITY vsftpd-size          "196 KB">
  <!ENTITY vsftpd-buildsize     "1.8 MB">
  <!ENTITY vsftpd-time          "less than 0.1 SBU">
  <!ENTITY vsftpd-empty         "/usr/share/vsftpd/empty">
]>

<sect1 id="vsftpd" xreflabel="vsftpd-&vsftpd-version;">
  <?dbhtml filename="vsftpd.html"?>

  <sect1info>
    <othername>$LastChangedBy: bdubbs $</othername>
    <date>$Date: 2015-03-02 17:33:58 -0500 (Mon, 02 Mar 2015) $</date>
  </sect1info>

  <title>vsftpd-&vsftpd-version;</title>

  <indexterm zone="vsftpd">
    <primary sortas="a-vsftpd">vsftpd</primary>
  </indexterm>

  <sect2 role="package">
    <title>Introduction to vsftpd</title>

    <para>The <application>vsftpd</application> package contains a very
    secure and very small FTP daemon. This is useful for serving files
    over a network.</para>

    &lfs77_checked;

    <bridgehead renderas="sect3">Package Information</bridgehead>
    <itemizedlist spacing="compact">
      <listitem>
        <para>Download (HTTP): <ulink url="&vsftpd-download-http;"/></para>
      </listitem>
      <listitem>
        <para>Download (FTP): <ulink url="&vsftpd-download-ftp;"/></para>
      </listitem>
      <listitem>
        <para>Download MD5 sum: &vsftpd-md5sum;</para>
      </listitem>
      <listitem>
        <para>Download size: &vsftpd-size;</para>
      </listitem>
      <listitem>
        <para>Estimated disk space required: &vsftpd-buildsize;</para>
      </listitem>
      <listitem>
        <para>Estimated build time: &vsftpd-time;</para>
      </listitem>
    </itemizedlist>

    <bridgehead renderas="sect3">vsftpd Dependencies</bridgehead>

    <bridgehead renderas="sect4">Optional</bridgehead>
    <para role="optional">
      <xref linkend="libcap-pam"/>,
      <xref linkend="linux-pam"/>, and
      <xref linkend="openssl"/>
    </para>

    <para condition="html" role="usernotes">User Notes:
    <ulink url="&blfs-wiki;/vsftpd"/></para>

  </sect2>

  <sect2 role="installation">
    <title>Installation of vsftpd</title>

    <para>For security reasons, running <application>vsftpd</application>
    as an unprivileged user and group is encouraged. Also, a user should be
    created to map anonymous users. As the <systemitem
    class="username">root</systemitem> user, create the needed directories,
    users, and groups with the following commands:</para>

<screen role="root"><userinput>install -v -d -m 0755 &vsftpd-empty; &amp;&amp;
install -v -d -m 0755 /home/ftp               &amp;&amp;
groupadd -g 47 vsftpd                         &amp;&amp;
groupadd -g 45 ftp                            &amp;&amp;

useradd -c "vsftpd User"  -d /dev/null -g vsftpd -s /bin/false -u 47 vsftpd &amp;&amp;
useradd -c anonymous_user -d /home/ftp -g ftp    -s /bin/false -u 45 ftp</userinput></screen>

    <para>If you did not install the optional <application>libcap2</application> package,
    run the following to avoid a build error:</para>

<screen><userinput>sed -i -e 's|#define VSF_SYSDEP_HAVE_LIBCAP|//&amp;|' sysdeputil.c</userinput></screen>

    <para>Build <application>vsftpd</application> as an unprivileged user
    using the following command:</para>

<screen><userinput>make</userinput></screen>

    <para>This package does not come with a test suite.</para>

    <para>Once again, become the <systemitem class="username">root</systemitem>
    user and install <application>vsftpd</application> with the following
    commands:</para>

<screen><userinput>install -v -m 755 vsftpd        /usr/sbin/vsftpd    &amp;&amp;
install -v -m 644 vsftpd.8      /usr/share/man/man8 &amp;&amp;
install -v -m 644 vsftpd.conf.5 /usr/share/man/man5 &amp;&amp;
install -v -m 644 vsftpd.conf   /etc</userinput></screen>

  </sect2>

  <sect2 role="commands">
    <title>Command Explanations</title>

    <para><command>install -v -d ...</command>: This creates the
    directory that anonymous users will use (<filename
    class='directory'>/home/ftp</filename>)
    and the directory the daemon will chroot into
    (<filename class='directory'>&vsftpd-empty;</filename>).</para>

    <note>
      <para><filename class="directory">/home/ftp</filename> should not be
      owned by the user <systemitem class="username">vsftpd</systemitem>,
      or the user <systemitem class="username">ftp</systemitem>.</para>
    </note>

    <para><command>echo "#define VSF_BUILD_TCPWRAPPERS" >>builddefs.h</command>:
    Use this prior to <command>make</command> to add support for
    <application>tcpwrappers</application>.</para>

    <para><command>echo "#define VSF_BUILD_SSL" >>builddefs.h</command>:
    Use this prior to <command>make</command> to add support for SSL.</para>

    <para><command>install -v -m ...</command>:
    The <filename>Makefile</filename> uses non-standard installation paths.
    These commands install the files in
    <filename class='directory'>/usr</filename> and
    <filename class='directory'>/etc</filename>.</para>

  </sect2>

  <sect2 role="configuration">
    <title>Configuring vsftpd</title>

    <sect3 id="vsftpd-config">
      <title>Config Files</title>

      <para><filename>/etc/vsftpd.conf</filename></para>

      <indexterm zone="vsftpd vsftpd-config">
        <primary sortas="e-etc-vsftpd.conf">/etc/vsftpd.conf</primary>
      </indexterm>

    </sect3>

    <sect3>
      <title>Configuration Information</title>

      <para><application>vsftpd</application> comes with a basic
      anonymous-only configuration file that was copied to
      <filename class='directory'>/etc</filename> above. While still as
      <systemitem class="username">root</systemitem>, this file should be
      modified because it is now recommended to run <command>vsftpd</command>
      in standalone mode. <!-- as opposed to
      <command>inetd</command>/<command>xinetd</command> mode. -->Also, you
      should specify the privilege separation user created above. Finally,
      you should specify the <command>chroot</command> directory.
      <command>man vsftpd.conf</command> will give you all the details.</para>

<screen role="root"><userinput>cat &gt;&gt; /etc/vsftpd.conf &lt;&lt; "EOF"
<literal>background=YES
listen=YES
nopriv_user=vsftpd
secure_chroot_dir=&vsftpd-empty;</literal>
EOF</userinput></screen>

    </sect3>

    <sect3  id="vsftpd-init">
      <title>Boot Script</title>

      <para>Install the <filename>/etc/rc.d/init.d/vsftpd</filename>
      init script included in the
      <xref linkend="bootscripts"/> package.</para>

<screen role="root"><userinput>make install-vsftpd</userinput></screen>

    </sect3>

  </sect2>

  <sect2 role="content">
    <title>Contents</title>

    <segmentedlist>
      <segtitle>Installed Program</segtitle>
      <segtitle>Installed Libraries</segtitle>
      <segtitle>Installed Directories</segtitle>

      <seglistitem>
        <seg>vsftpd</seg>
        <seg>None</seg>
        <seg>//usr/share/vsftpd, /home/ftp</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="vsftpd-prog">
        <term><command>vsftpd</command></term>
        <listitem>
          <para>is the FTP daemon.</para>
          <indexterm zone="vsftpd vsftpd-prog">
            <primary sortas="b-vsftpd">vsftpd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
