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