[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 |
|
---|
[a57b443] | 39 | &lfs101_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 |
|
---|
[5aac6876] | 82 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 83 | <para role="recommended">
|
---|
| 84 | <xref linkend="linux-pam"/>
|
---|
| 85 | </para>
|
---|
| 86 |
|
---|
[f8ff412] | 87 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[e79ed72] | 88 | <para role="optional">
|
---|
[5aac6876] | 89 | <xref linkend="libcap-pam"/>
|
---|
[e79ed72] | 90 | </para>
|
---|
[f8ff412] | 91 |
|
---|
[3cb0c57] | 92 | <para condition="html" role="usernotes">User Notes:
|
---|
| 93 | <ulink url="&blfs-wiki;/vsftpd"/></para>
|
---|
| 94 |
|
---|
[f8ff412] | 95 | </sect2>
|
---|
| 96 |
|
---|
| 97 | <sect2 role="installation">
|
---|
[32ccdf34] | 98 | <title>Installation of vsftpd</title>
|
---|
[f8ff412] | 99 |
|
---|
[4472e923] | 100 | <para>
|
---|
| 101 | For security reasons, running <application>vsftpd</application>
|
---|
| 102 | as an unprivileged user and group is encouraged. Also, a user should be
|
---|
| 103 | created to map anonymous users. As the <systemitem
|
---|
| 104 | class="username">root</systemitem> user, create the needed directories,
|
---|
| 105 | users, and groups with the following commands:
|
---|
| 106 | </para>
|
---|
[f8ff412] | 107 |
|
---|
[620b04a] | 108 | <screen role="root"><userinput>install -v -d -m 0755 &vsftpd-empty; &&
|
---|
| 109 | install -v -d -m 0755 /home/ftp &&
|
---|
| 110 | groupadd -g 47 vsftpd &&
|
---|
| 111 | groupadd -g 45 ftp &&
|
---|
[283bd88] | 112 |
|
---|
[5f2eb36] | 113 | useradd -c "vsftpd User" -d /dev/null -g vsftpd -s /bin/false -u 47 vsftpd &&
|
---|
| 114 | useradd -c anonymous_user -d /home/ftp -g ftp -s /bin/false -u 45 ftp</userinput></screen>
|
---|
[d7c8734] | 115 |
|
---|
[9214104] | 116 | <para>
|
---|
| 117 | Gcc-10 and later flags an error for an implicit type cast. Make it
|
---|
| 118 | explicit:
|
---|
| 119 | </para>
|
---|
| 120 |
|
---|
| 121 | <screen><userinput>sed -e "s/kVSFSysStrOpenUnknown;/(enum EVSFSysUtilOpenMode)&/" -i sysstr.c</userinput></screen>
|
---|
| 122 |
|
---|
[4472e923] | 123 | <para>
|
---|
| 124 | Build <application>vsftpd</application> as an unprivileged user
|
---|
| 125 | using the following command:
|
---|
| 126 | </para>
|
---|
[d7c8734] | 127 |
|
---|
[939e5f5] | 128 | <screen><userinput>make</userinput></screen>
|
---|
| 129 |
|
---|
[4472e923] | 130 | <para>
|
---|
| 131 | This package does not come with a test suite.
|
---|
| 132 | </para>
|
---|
[81d09ea] | 133 |
|
---|
[4472e923] | 134 | <para>
|
---|
| 135 | Once again, become the <systemitem class="username">root</systemitem>
|
---|
| 136 | user and install <application>vsftpd</application> with the following
|
---|
| 137 | commands:
|
---|
| 138 | </para>
|
---|
[939e5f5] | 139 |
|
---|
[1c7e5c8a] | 140 | <screen role="root"><userinput>install -v -m 755 vsftpd /usr/sbin/vsftpd &&
|
---|
[5f2eb36] | 141 | install -v -m 644 vsftpd.8 /usr/share/man/man8 &&
|
---|
[f8ff412] | 142 | install -v -m 644 vsftpd.conf.5 /usr/share/man/man5 &&
|
---|
[5f2eb36] | 143 | install -v -m 644 vsftpd.conf /etc</userinput></screen>
|
---|
[d7c8734] | 144 |
|
---|
[f8ff412] | 145 | </sect2>
|
---|
[d7c8734] | 146 |
|
---|
[f8ff412] | 147 | <sect2 role="commands">
|
---|
| 148 | <title>Command Explanations</title>
|
---|
[d7c8734] | 149 |
|
---|
[4472e923] | 150 | <para>
|
---|
| 151 | <command>install -v -d ...</command>: This creates the
|
---|
| 152 | directory that anonymous users will use (<filename
|
---|
| 153 | class='directory'>/home/ftp</filename>)
|
---|
| 154 | and the directory the daemon will chroot into
|
---|
| 155 | (<filename class='directory'>&vsftpd-empty;</filename>).
|
---|
| 156 | </para>
|
---|
[d7c8734] | 157 |
|
---|
[f8ff412] | 158 | <note>
|
---|
[4472e923] | 159 | <para>
|
---|
| 160 | <filename class="directory">/home/ftp</filename> should not be
|
---|
| 161 | owned by the user <systemitem class="username">vsftpd</systemitem>,
|
---|
| 162 | or the user <systemitem class="username">ftp</systemitem>.
|
---|
| 163 | </para>
|
---|
[f8ff412] | 164 | </note>
|
---|
[d7c8734] | 165 |
|
---|
[4472e923] | 166 | <para>
|
---|
| 167 | <command>echo "#define VSF_BUILD_TCPWRAPPERS" >>builddefs.h</command>:
|
---|
| 168 | Use this prior to <command>make</command> to add support for
|
---|
| 169 | <application>tcpwrappers</application>.
|
---|
| 170 | </para>
|
---|
[d7c8734] | 171 |
|
---|
[4472e923] | 172 | <para>
|
---|
| 173 | <command>echo "#define VSF_BUILD_SSL" >>builddefs.h</command>:
|
---|
| 174 | Use this prior to <command>make</command> to add support for SSL.
|
---|
| 175 | </para>
|
---|
[d7c8734] | 176 |
|
---|
[4472e923] | 177 | <para>
|
---|
| 178 | <command>install -v -m ...</command>:
|
---|
| 179 | The <filename>Makefile</filename> uses non-standard installation paths.
|
---|
| 180 | These commands install the files in
|
---|
| 181 | <filename class='directory'>/usr</filename> and
|
---|
| 182 | <filename class='directory'>/etc</filename>.
|
---|
| 183 | </para>
|
---|
[d7c8734] | 184 |
|
---|
[f8ff412] | 185 | </sect2>
|
---|
[d7c8734] | 186 |
|
---|
[f8ff412] | 187 | <sect2 role="configuration">
|
---|
[32ccdf34] | 188 | <title>Configuring vsftpd</title>
|
---|
[d7c8734] | 189 |
|
---|
[f8ff412] | 190 | <sect3 id="vsftpd-config">
|
---|
| 191 | <title>Config Files</title>
|
---|
[1586494] | 192 |
|
---|
[4472e923] | 193 | <para>
|
---|
| 194 | <filename>/etc/vsftpd.conf</filename>
|
---|
| 195 | </para>
|
---|
[d7c8734] | 196 |
|
---|
[f8ff412] | 197 | <indexterm zone="vsftpd vsftpd-config">
|
---|
| 198 | <primary sortas="e-etc-vsftpd.conf">/etc/vsftpd.conf</primary>
|
---|
| 199 | </indexterm>
|
---|
[d7c8734] | 200 |
|
---|
[f8ff412] | 201 | </sect3>
|
---|
[d7c8734] | 202 |
|
---|
[f8ff412] | 203 | <sect3>
|
---|
| 204 | <title>Configuration Information</title>
|
---|
[d7c8734] | 205 |
|
---|
[4472e923] | 206 | <para>
|
---|
| 207 | <application>vsftpd</application> comes with a basic
|
---|
| 208 | anonymous-only configuration file that was copied to
|
---|
| 209 | <filename class='directory'>/etc</filename> above. While still as
|
---|
| 210 | <systemitem class="username">root</systemitem>, this file should be
|
---|
| 211 | modified because it is now recommended to run <command>vsftpd</command>
|
---|
| 212 | in standalone mode. Also, you
|
---|
| 213 | should specify the privilege separation user created above. Finally,
|
---|
| 214 | you should specify the <command>chroot</command> directory.
|
---|
| 215 | <command>man vsftpd.conf</command> will give you all the details.
|
---|
| 216 | </para>
|
---|
[f8ff412] | 217 |
|
---|
| 218 | <screen role="root"><userinput>cat >> /etc/vsftpd.conf << "EOF"
|
---|
| 219 | <literal>background=YES
|
---|
[d7c8734] | 220 | listen=YES
|
---|
| 221 | nopriv_user=vsftpd
|
---|
[620b04a] | 222 | secure_chroot_dir=&vsftpd-empty;</literal>
|
---|
[21a30d1] | 223 | EOF</userinput></screen>
|
---|
| 224 |
|
---|
| 225 | <!-- recheck this issue when vsftpd is updated -->
|
---|
[4472e923] | 226 | <para>
|
---|
| 227 | The vsftpd daemon uses seccomp to improve security by default.
|
---|
| 228 | But it's known to cause vsftpd unable to handle ftp
|
---|
| 229 | <literal>LIST</literal> command with recent kernel versions. Append
|
---|
| 230 | a line to <filename>/etc/vsftpd.conf</filename> (as the
|
---|
| 231 | <systemitem class="username">root</systemitem> user) to disable
|
---|
| 232 | seccomp and workaround this issue:
|
---|
| 233 | </para>
|
---|
[21a30d1] | 234 |
|
---|
| 235 | <screen role="root"><userinput>cat >> /etc/vsftpd.conf << "EOF"
|
---|
| 236 | <literal>seccomp_sandbox=NO</literal>
|
---|
[ee92087f] | 237 | EOF</userinput></screen>
|
---|
| 238 |
|
---|
[4472e923] | 239 | <para>
|
---|
| 240 | To enable local logins, append the following to the
|
---|
| 241 | <filename>/etc/vsftpd.conf</filename> file (as the
|
---|
| 242 | <systemitem class="username">root</systemitem> user):
|
---|
| 243 | </para>
|
---|
[ee92087f] | 244 |
|
---|
[1dd7b0ae] | 245 | <screen role="root"><userinput>cat >> /etc/vsftpd.conf << "EOF"
|
---|
[ee92087f] | 246 | <literal>local_enable=YES</literal>
|
---|
| 247 | EOF</userinput></screen>
|
---|
| 248 |
|
---|
[4472e923] | 249 | <para>
|
---|
| 250 | In addition, if using <application>Linux-PAM</application> and
|
---|
| 251 | <application>vsftpd</application> with local user logins, you will need
|
---|
| 252 | a <application>Linux-PAM</application> configuration file. As the
|
---|
| 253 | <systemitem class="username">root</systemitem> user, create the
|
---|
| 254 | <filename>/etc/pam.d/vsftpd</filename> file, and add the needed
|
---|
| 255 | configuration changes for <application>Linux-PAM</application> session
|
---|
| 256 | support using the following commands:
|
---|
| 257 | </para>
|
---|
[ee92087f] | 258 |
|
---|
[1dd7b0ae] | 259 | <screen role="root"><userinput>cat > /etc/pam.d/vsftpd << "EOF" &&
|
---|
[ee92087f] | 260 | <literal># Begin /etc/pam.d/vsftpd
|
---|
| 261 | auth required /lib/security/pam_listfile.so item=user sense=deny \
|
---|
| 262 | file=/etc/ftpusers \
|
---|
| 263 | onerr=succeed
|
---|
| 264 | auth required pam_shells.so
|
---|
| 265 | auth include system-auth
|
---|
| 266 | account include system-account
|
---|
| 267 | session include system-session</literal>
|
---|
| 268 | EOF
|
---|
| 269 |
|
---|
| 270 | cat >> /etc/vsftpd.conf << "EOF"
|
---|
| 271 | <literal>session_support=YES
|
---|
| 272 | pam_service_name=vsftpd</literal>
|
---|
[f8ff412] | 273 | EOF</userinput></screen>
|
---|
[d7c8734] | 274 |
|
---|
[f8ff412] | 275 | </sect3>
|
---|
[d7c8734] | 276 |
|
---|
[f8ff412] | 277 | <sect3 id="vsftpd-init">
|
---|
[ee92087f] | 278 | <title><phrase revision="sysv">Boot Script</phrase>
|
---|
| 279 | <phrase revision="systemd">Systemd Unit</phrase></title>
|
---|
| 280 |
|
---|
[4472e923] | 281 | <para>
|
---|
| 282 | Install the
|
---|
| 283 | <phrase revision="sysv"><filename>/etc/rc.d/init.d/vsftpd</filename>
|
---|
| 284 | init script</phrase>
|
---|
| 285 | <phrase revision="systemd"><filename>vsftpd.service</filename>
|
---|
| 286 | unit</phrase> included in the
|
---|
| 287 | <xref linkend="bootscripts" revision="sysv"/>
|
---|
| 288 | <xref linkend="systemd-units" revision="systemd"/> package:
|
---|
| 289 | </para>
|
---|
[d7c8734] | 290 |
|
---|
[f8ff412] | 291 | <screen role="root"><userinput>make install-vsftpd</userinput></screen>
|
---|
[d7c8734] | 292 |
|
---|
[f8ff412] | 293 | </sect3>
|
---|
[d7c8734] | 294 |
|
---|
[f8ff412] | 295 | </sect2>
|
---|
[d7c8734] | 296 |
|
---|
[f8ff412] | 297 | <sect2 role="content">
|
---|
| 298 | <title>Contents</title>
|
---|
[d7c8734] | 299 |
|
---|
[f8ff412] | 300 | <segmentedlist>
|
---|
| 301 | <segtitle>Installed Program</segtitle>
|
---|
| 302 | <segtitle>Installed Libraries</segtitle>
|
---|
| 303 | <segtitle>Installed Directories</segtitle>
|
---|
| 304 |
|
---|
| 305 | <seglistitem>
|
---|
| 306 | <seg>vsftpd</seg>
|
---|
| 307 | <seg>None</seg>
|
---|
[523c6e95] | 308 | <seg>/usr/share/vsftpd, /home/ftp</seg>
|
---|
[f8ff412] | 309 | </seglistitem>
|
---|
| 310 | </segmentedlist>
|
---|
| 311 |
|
---|
| 312 | <variablelist>
|
---|
| 313 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 314 | <?dbfo list-presentation="list"?>
|
---|
| 315 | <?dbhtml list-presentation="table"?>
|
---|
[d7c8734] | 316 |
|
---|
[f8ff412] | 317 | <varlistentry id="vsftpd-prog">
|
---|
| 318 | <term><command>vsftpd</command></term>
|
---|
| 319 | <listitem>
|
---|
[4472e923] | 320 | <para>
|
---|
[4c24eb0a] | 321 | is the FTP daemon
|
---|
[4472e923] | 322 | </para>
|
---|
[f8ff412] | 323 | <indexterm zone="vsftpd vsftpd-prog">
|
---|
| 324 | <primary sortas="b-vsftpd">vsftpd</primary>
|
---|
| 325 | </indexterm>
|
---|
| 326 | </listitem>
|
---|
| 327 | </varlistentry>
|
---|
| 328 |
|
---|
| 329 | </variablelist>
|
---|
| 330 |
|
---|
| 331 | </sect2>
|
---|
| 332 |
|
---|
| 333 | </sect1>
|
---|