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