[d7c8734] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[6732c094] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[d7c8734] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[436af1c] | 7 | <!ENTITY vsftpd-download-http "https://security.appspot.com/downloads/vsftpd-&vsftpd-version;.tar.gz">
|
---|
| 8 | <!ENTITY vsftpd-download-ftp " ">
|
---|
[73fe507] | 9 | <!ENTITY vsftpd-md5sum "da119d084bd3f98664636ea05b5bb398">
|
---|
[59c4cab] | 10 | <!ENTITY vsftpd-size "196 KB">
|
---|
[73fe507] | 11 | <!ENTITY vsftpd-buildsize "2 MB">
|
---|
[939e5f5] | 12 | <!ENTITY vsftpd-time "less than 0.1 SBU">
|
---|
[620b04a] | 13 | <!ENTITY vsftpd-empty "/usr/share/vsftpd/empty">
|
---|
[d7c8734] | 14 | ]>
|
---|
| 15 |
|
---|
[32ccdf34] | 16 | <sect1 id="vsftpd" xreflabel="vsftpd-&vsftpd-version;">
|
---|
[f8ff412] | 17 | <?dbhtml filename="vsftpd.html"?>
|
---|
| 18 |
|
---|
| 19 | <sect1info>
|
---|
| 20 | <othername>$LastChangedBy$</othername>
|
---|
| 21 | <date>$Date$</date>
|
---|
| 22 | </sect1info>
|
---|
| 23 |
|
---|
[32ccdf34] | 24 | <title>vsftpd-&vsftpd-version;</title>
|
---|
[f8ff412] | 25 |
|
---|
| 26 | <indexterm zone="vsftpd">
|
---|
[32ccdf34] | 27 | <primary sortas="a-vsftpd">vsftpd</primary>
|
---|
[f8ff412] | 28 | </indexterm>
|
---|
| 29 |
|
---|
[4e82a189] | 30 | <sect2 role="package">
|
---|
[32ccdf34] | 31 | <title>Introduction to vsftpd</title>
|
---|
[f8ff412] | 32 |
|
---|
[4472e923] | 33 | <para>
|
---|
| 34 | The <application>vsftpd</application> package contains a very
|
---|
| 35 | secure and very small FTP daemon. This is useful for serving files
|
---|
| 36 | over a network.
|
---|
| 37 | </para>
|
---|
[f8ff412] | 38 |
|
---|
[d42fa7ee] | 39 | &lfs91_checked;
|
---|
[5f2eb36] | 40 |
|
---|
[f8ff412] | 41 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 42 | <itemizedlist spacing="compact">
|
---|
| 43 | <listitem>
|
---|
[4472e923] | 44 | <para>
|
---|
| 45 | Download (HTTP): <ulink url="&vsftpd-download-http;"/>
|
---|
| 46 | </para>
|
---|
[f8ff412] | 47 | </listitem>
|
---|
| 48 | <listitem>
|
---|
[4472e923] | 49 | <para>
|
---|
| 50 | Download (FTP): <ulink url="&vsftpd-download-ftp;"/>
|
---|
| 51 | </para>
|
---|
[f8ff412] | 52 | </listitem>
|
---|
| 53 | <listitem>
|
---|
[4472e923] | 54 | <para>
|
---|
| 55 | Download MD5 sum: &vsftpd-md5sum;
|
---|
| 56 | </para>
|
---|
[f8ff412] | 57 | </listitem>
|
---|
| 58 | <listitem>
|
---|
[4472e923] | 59 | <para>
|
---|
| 60 | Download size: &vsftpd-size;
|
---|
| 61 | </para>
|
---|
[f8ff412] | 62 | </listitem>
|
---|
| 63 | <listitem>
|
---|
[4472e923] | 64 | <para>
|
---|
| 65 | Estimated disk space required: &vsftpd-buildsize;
|
---|
| 66 | </para>
|
---|
[f8ff412] | 67 | </listitem>
|
---|
| 68 | <listitem>
|
---|
[4472e923] | 69 | <para>
|
---|
| 70 | Estimated build time: &vsftpd-time;
|
---|
| 71 | </para>
|
---|
[f8ff412] | 72 | </listitem>
|
---|
| 73 | </itemizedlist>
|
---|
| 74 |
|
---|
[32ccdf34] | 75 | <bridgehead renderas="sect3">vsftpd Dependencies</bridgehead>
|
---|
[f8ff412] | 76 |
|
---|
[fa5ba12] | 77 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 78 | <para role="required">
|
---|
| 79 | <xref linkend="libnsl"/>
|
---|
| 80 | </para>
|
---|
| 81 |
|
---|
[f8ff412] | 82 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[e79ed72] | 83 | <para role="optional">
|
---|
[421e0cb2] | 84 | <xref linkend="libcap-pam"/>, and
|
---|
| 85 | <xref linkend="linux-pam"/>
|
---|
[e79ed72] | 86 | </para>
|
---|
[f8ff412] | 87 |
|
---|
[3cb0c57] | 88 | <para condition="html" role="usernotes">User Notes:
|
---|
| 89 | <ulink url="&blfs-wiki;/vsftpd"/></para>
|
---|
| 90 |
|
---|
[f8ff412] | 91 | </sect2>
|
---|
| 92 |
|
---|
| 93 | <sect2 role="installation">
|
---|
[32ccdf34] | 94 | <title>Installation of vsftpd</title>
|
---|
[f8ff412] | 95 |
|
---|
[4472e923] | 96 | <para>
|
---|
| 97 | For security reasons, running <application>vsftpd</application>
|
---|
| 98 | as an unprivileged user and group is encouraged. Also, a user should be
|
---|
| 99 | created to map anonymous users. As the <systemitem
|
---|
| 100 | class="username">root</systemitem> user, create the needed directories,
|
---|
| 101 | users, and groups with the following commands:
|
---|
| 102 | </para>
|
---|
[f8ff412] | 103 |
|
---|
[620b04a] | 104 | <screen role="root"><userinput>install -v -d -m 0755 &vsftpd-empty; &&
|
---|
| 105 | install -v -d -m 0755 /home/ftp &&
|
---|
| 106 | groupadd -g 47 vsftpd &&
|
---|
| 107 | groupadd -g 45 ftp &&
|
---|
[283bd88] | 108 |
|
---|
[5f2eb36] | 109 | useradd -c "vsftpd User" -d /dev/null -g vsftpd -s /bin/false -u 47 vsftpd &&
|
---|
| 110 | useradd -c anonymous_user -d /home/ftp -g ftp -s /bin/false -u 45 ftp</userinput></screen>
|
---|
[d7c8734] | 111 |
|
---|
[9214104] | 112 | <para>
|
---|
| 113 | Gcc-10 and later flags an error for an implicit type cast. Make it
|
---|
| 114 | explicit:
|
---|
| 115 | </para>
|
---|
| 116 |
|
---|
| 117 | <screen><userinput>sed -e "s/kVSFSysStrOpenUnknown;/(enum EVSFSysUtilOpenMode)&/" -i sysstr.c</userinput></screen>
|
---|
| 118 |
|
---|
[4472e923] | 119 | <para>
|
---|
| 120 | Build <application>vsftpd</application> as an unprivileged user
|
---|
| 121 | using the following command:
|
---|
| 122 | </para>
|
---|
[d7c8734] | 123 |
|
---|
[939e5f5] | 124 | <screen><userinput>make</userinput></screen>
|
---|
| 125 |
|
---|
[4472e923] | 126 | <para>
|
---|
| 127 | This package does not come with a test suite.
|
---|
| 128 | </para>
|
---|
[81d09ea] | 129 |
|
---|
[4472e923] | 130 | <para>
|
---|
| 131 | Once again, become the <systemitem class="username">root</systemitem>
|
---|
| 132 | user and install <application>vsftpd</application> with the following
|
---|
| 133 | commands:
|
---|
| 134 | </para>
|
---|
[939e5f5] | 135 |
|
---|
[1c7e5c8a] | 136 | <screen role="root"><userinput>install -v -m 755 vsftpd /usr/sbin/vsftpd &&
|
---|
[5f2eb36] | 137 | install -v -m 644 vsftpd.8 /usr/share/man/man8 &&
|
---|
[f8ff412] | 138 | install -v -m 644 vsftpd.conf.5 /usr/share/man/man5 &&
|
---|
[5f2eb36] | 139 | install -v -m 644 vsftpd.conf /etc</userinput></screen>
|
---|
[d7c8734] | 140 |
|
---|
[f8ff412] | 141 | </sect2>
|
---|
[d7c8734] | 142 |
|
---|
[f8ff412] | 143 | <sect2 role="commands">
|
---|
| 144 | <title>Command Explanations</title>
|
---|
[d7c8734] | 145 |
|
---|
[4472e923] | 146 | <para>
|
---|
| 147 | <command>install -v -d ...</command>: This creates the
|
---|
| 148 | directory that anonymous users will use (<filename
|
---|
| 149 | class='directory'>/home/ftp</filename>)
|
---|
| 150 | and the directory the daemon will chroot into
|
---|
| 151 | (<filename class='directory'>&vsftpd-empty;</filename>).
|
---|
| 152 | </para>
|
---|
[d7c8734] | 153 |
|
---|
[f8ff412] | 154 | <note>
|
---|
[4472e923] | 155 | <para>
|
---|
| 156 | <filename class="directory">/home/ftp</filename> should not be
|
---|
| 157 | owned by the user <systemitem class="username">vsftpd</systemitem>,
|
---|
| 158 | or the user <systemitem class="username">ftp</systemitem>.
|
---|
| 159 | </para>
|
---|
[f8ff412] | 160 | </note>
|
---|
[d7c8734] | 161 |
|
---|
[4472e923] | 162 | <para>
|
---|
| 163 | <command>echo "#define VSF_BUILD_TCPWRAPPERS" >>builddefs.h</command>:
|
---|
| 164 | Use this prior to <command>make</command> to add support for
|
---|
| 165 | <application>tcpwrappers</application>.
|
---|
| 166 | </para>
|
---|
[d7c8734] | 167 |
|
---|
[4472e923] | 168 | <para>
|
---|
| 169 | <command>echo "#define VSF_BUILD_SSL" >>builddefs.h</command>:
|
---|
| 170 | Use this prior to <command>make</command> to add support for SSL.
|
---|
| 171 | </para>
|
---|
[d7c8734] | 172 |
|
---|
[4472e923] | 173 | <para>
|
---|
| 174 | <command>install -v -m ...</command>:
|
---|
| 175 | The <filename>Makefile</filename> uses non-standard installation paths.
|
---|
| 176 | These commands install the files in
|
---|
| 177 | <filename class='directory'>/usr</filename> and
|
---|
| 178 | <filename class='directory'>/etc</filename>.
|
---|
| 179 | </para>
|
---|
[d7c8734] | 180 |
|
---|
[f8ff412] | 181 | </sect2>
|
---|
[d7c8734] | 182 |
|
---|
[f8ff412] | 183 | <sect2 role="configuration">
|
---|
[32ccdf34] | 184 | <title>Configuring vsftpd</title>
|
---|
[d7c8734] | 185 |
|
---|
[f8ff412] | 186 | <sect3 id="vsftpd-config">
|
---|
| 187 | <title>Config Files</title>
|
---|
[1586494] | 188 |
|
---|
[4472e923] | 189 | <para>
|
---|
| 190 | <filename>/etc/vsftpd.conf</filename>
|
---|
| 191 | </para>
|
---|
[d7c8734] | 192 |
|
---|
[f8ff412] | 193 | <indexterm zone="vsftpd vsftpd-config">
|
---|
| 194 | <primary sortas="e-etc-vsftpd.conf">/etc/vsftpd.conf</primary>
|
---|
| 195 | </indexterm>
|
---|
[d7c8734] | 196 |
|
---|
[f8ff412] | 197 | </sect3>
|
---|
[d7c8734] | 198 |
|
---|
[f8ff412] | 199 | <sect3>
|
---|
| 200 | <title>Configuration Information</title>
|
---|
[d7c8734] | 201 |
|
---|
[4472e923] | 202 | <para>
|
---|
| 203 | <application>vsftpd</application> comes with a basic
|
---|
| 204 | anonymous-only configuration file that was copied to
|
---|
| 205 | <filename class='directory'>/etc</filename> above. While still as
|
---|
| 206 | <systemitem class="username">root</systemitem>, this file should be
|
---|
| 207 | modified because it is now recommended to run <command>vsftpd</command>
|
---|
| 208 | in standalone mode. Also, you
|
---|
| 209 | should specify the privilege separation user created above. Finally,
|
---|
| 210 | you should specify the <command>chroot</command> directory.
|
---|
| 211 | <command>man vsftpd.conf</command> will give you all the details.
|
---|
| 212 | </para>
|
---|
[f8ff412] | 213 |
|
---|
| 214 | <screen role="root"><userinput>cat >> /etc/vsftpd.conf << "EOF"
|
---|
| 215 | <literal>background=YES
|
---|
[d7c8734] | 216 | listen=YES
|
---|
| 217 | nopriv_user=vsftpd
|
---|
[620b04a] | 218 | secure_chroot_dir=&vsftpd-empty;</literal>
|
---|
[21a30d1] | 219 | EOF</userinput></screen>
|
---|
| 220 |
|
---|
| 221 | <!-- recheck this issue when vsftpd is updated -->
|
---|
[4472e923] | 222 | <para>
|
---|
| 223 | The vsftpd daemon uses seccomp to improve security by default.
|
---|
| 224 | But it's known to cause vsftpd unable to handle ftp
|
---|
| 225 | <literal>LIST</literal> command with recent kernel versions. Append
|
---|
| 226 | a line to <filename>/etc/vsftpd.conf</filename> (as the
|
---|
| 227 | <systemitem class="username">root</systemitem> user) to disable
|
---|
| 228 | seccomp and workaround this issue:
|
---|
| 229 | </para>
|
---|
[21a30d1] | 230 |
|
---|
| 231 | <screen role="root"><userinput>cat >> /etc/vsftpd.conf << "EOF"
|
---|
| 232 | <literal>seccomp_sandbox=NO</literal>
|
---|
[ee92087f] | 233 | EOF</userinput></screen>
|
---|
| 234 |
|
---|
[4472e923] | 235 | <para>
|
---|
| 236 | To enable local logins, append the following to the
|
---|
| 237 | <filename>/etc/vsftpd.conf</filename> file (as the
|
---|
| 238 | <systemitem class="username">root</systemitem> user):
|
---|
| 239 | </para>
|
---|
[ee92087f] | 240 |
|
---|
[1dd7b0ae] | 241 | <screen role="root"><userinput>cat >> /etc/vsftpd.conf << "EOF"
|
---|
[ee92087f] | 242 | <literal>local_enable=YES</literal>
|
---|
| 243 | EOF</userinput></screen>
|
---|
| 244 |
|
---|
[4472e923] | 245 | <para>
|
---|
| 246 | In addition, if using <application>Linux-PAM</application> and
|
---|
| 247 | <application>vsftpd</application> with local user logins, you will need
|
---|
| 248 | a <application>Linux-PAM</application> configuration file. As the
|
---|
| 249 | <systemitem class="username">root</systemitem> user, create the
|
---|
| 250 | <filename>/etc/pam.d/vsftpd</filename> file, and add the needed
|
---|
| 251 | configuration changes for <application>Linux-PAM</application> session
|
---|
| 252 | support using the following commands:
|
---|
| 253 | </para>
|
---|
[ee92087f] | 254 |
|
---|
[1dd7b0ae] | 255 | <screen role="root"><userinput>cat > /etc/pam.d/vsftpd << "EOF" &&
|
---|
[ee92087f] | 256 | <literal># Begin /etc/pam.d/vsftpd
|
---|
| 257 | auth required /lib/security/pam_listfile.so item=user sense=deny \
|
---|
| 258 | file=/etc/ftpusers \
|
---|
| 259 | onerr=succeed
|
---|
| 260 | auth required pam_shells.so
|
---|
| 261 | auth include system-auth
|
---|
| 262 | account include system-account
|
---|
| 263 | session include system-session</literal>
|
---|
| 264 | EOF
|
---|
| 265 |
|
---|
| 266 | cat >> /etc/vsftpd.conf << "EOF"
|
---|
| 267 | <literal>session_support=YES
|
---|
| 268 | pam_service_name=vsftpd</literal>
|
---|
[f8ff412] | 269 | EOF</userinput></screen>
|
---|
[d7c8734] | 270 |
|
---|
[f8ff412] | 271 | </sect3>
|
---|
[d7c8734] | 272 |
|
---|
[f8ff412] | 273 | <sect3 id="vsftpd-init">
|
---|
[ee92087f] | 274 | <title><phrase revision="sysv">Boot Script</phrase>
|
---|
| 275 | <phrase revision="systemd">Systemd Unit</phrase></title>
|
---|
| 276 |
|
---|
[4472e923] | 277 | <para>
|
---|
| 278 | Install the
|
---|
| 279 | <phrase revision="sysv"><filename>/etc/rc.d/init.d/vsftpd</filename>
|
---|
| 280 | init script</phrase>
|
---|
| 281 | <phrase revision="systemd"><filename>vsftpd.service</filename>
|
---|
| 282 | unit</phrase> included in the
|
---|
| 283 | <xref linkend="bootscripts" revision="sysv"/>
|
---|
| 284 | <xref linkend="systemd-units" revision="systemd"/> package:
|
---|
| 285 | </para>
|
---|
[d7c8734] | 286 |
|
---|
[f8ff412] | 287 | <screen role="root"><userinput>make install-vsftpd</userinput></screen>
|
---|
[d7c8734] | 288 |
|
---|
[f8ff412] | 289 | </sect3>
|
---|
[d7c8734] | 290 |
|
---|
[f8ff412] | 291 | </sect2>
|
---|
[d7c8734] | 292 |
|
---|
[f8ff412] | 293 | <sect2 role="content">
|
---|
| 294 | <title>Contents</title>
|
---|
[d7c8734] | 295 |
|
---|
[f8ff412] | 296 | <segmentedlist>
|
---|
| 297 | <segtitle>Installed Program</segtitle>
|
---|
| 298 | <segtitle>Installed Libraries</segtitle>
|
---|
| 299 | <segtitle>Installed Directories</segtitle>
|
---|
| 300 |
|
---|
| 301 | <seglistitem>
|
---|
| 302 | <seg>vsftpd</seg>
|
---|
| 303 | <seg>None</seg>
|
---|
[523c6e95] | 304 | <seg>/usr/share/vsftpd, /home/ftp</seg>
|
---|
[f8ff412] | 305 | </seglistitem>
|
---|
| 306 | </segmentedlist>
|
---|
| 307 |
|
---|
| 308 | <variablelist>
|
---|
| 309 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 310 | <?dbfo list-presentation="list"?>
|
---|
| 311 | <?dbhtml list-presentation="table"?>
|
---|
[d7c8734] | 312 |
|
---|
[f8ff412] | 313 | <varlistentry id="vsftpd-prog">
|
---|
| 314 | <term><command>vsftpd</command></term>
|
---|
| 315 | <listitem>
|
---|
[4472e923] | 316 | <para>
|
---|
| 317 | is the FTP daemon.
|
---|
| 318 | </para>
|
---|
[f8ff412] | 319 | <indexterm zone="vsftpd vsftpd-prog">
|
---|
| 320 | <primary sortas="b-vsftpd">vsftpd</primary>
|
---|
| 321 | </indexterm>
|
---|
| 322 | </listitem>
|
---|
| 323 | </varlistentry>
|
---|
| 324 |
|
---|
| 325 | </variablelist>
|
---|
| 326 |
|
---|
| 327 | </sect2>
|
---|
| 328 |
|
---|
| 329 | </sect1>
|
---|