Debian Codegraph @

doc/modules/mod_auth_unix.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ProFTPD module mod_auth_unix</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr>
10 <center>
11 <h2><b>ProFTPD module <code>mod_auth_unix</code></b></h2>
12 </center>
13 <hr><br>
14
15 <p>
16 This module is contained in the <code>mod_auth_unix.c</code> file for
17 ProFTPD 1.3.<i>x</i>, and is compiled by default.
18
19 <h2>Directives</h2>
20 <ul>
21 <li><a href="#AuthUnixOptions">AuthUnixOptions</a>
22 <li><a href="#PersistentPasswd">PersistentPasswd</a>
23 </ul>
24
25 <hr>
26 <h3><a name="AuthUnixOptions">AuthUnixOptions</a></h3>
27 <strong>Syntax:</strong> AuthUnixOptions <em>opt1 ...</em><br>
28 <strong>Default:</strong> None<br>
29 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
30 <strong>Module:</strong> mod_auth_unix<br>
31 <strong>Compatibility:</strong> 1.3.3rc2
32
33 <p>
34 The <code>AuthUnixOptions</code> directive is used to tweak various
35 Unix-specific authentication behaviors in <code>mod_auth_unix</code>. The
36 currently implemented options are:
37 <ul>
38 <li><code>AIXNoRLogin</code><br>
39 <p>
40 In <a href="http://bugs.proftpd.org/show_bug.cgi?id=1896">Bug#1896</a>,
41 support for checking some AIX-specific functions for whether a login
42 should be accepted was added; this happens only on AIX servers, of course.
43
44 <p>
45 However, some AIX admins like to configure "rlogin=false", yet still want
46 to allow FTP logins. To enable this specific behavior, a new
47 <code>AuthUnixOptions</code> setting (only honored on AIX) was added:
48 <pre>
49 AuthUnixOptions AIXNoRLogin
50 </pre>
51 If this setting is used on any other server, it is silently ignored.
52 <a href="http://bugs.proftpd.org/show_bug.cgi?id=3300">Bug#3300</a> has
53 the full details.
54 </li>
55
56 <p>
57 <li><code>MagicTokenChroot</code><br>
58 <p>
59 This option causes <code>mod_auth_unix</code> to examine the home
60 directory retrieved for a user for the magic "/./" token. If found,
61 the portion of the directory before the token will be used for the
62 <code>chroot()</code> for the process; the portion after the token
63 will be the default directory for the process.
64
65 <p>
66 <b>Note</b> that this will override any configured <code>DefaultRoot</code>
67 and <code>DefaultChdir</code> directives.
68
69 <p>
70 This option is intended for use for sites which are migrating from
71 old <code>wuftpd</code>-based installations.
72 </li>
73
74 <p>
75 <li><code>NoGetgrouplist</code><br>
76 <p>
77 On systems which support it, the <code>getgrouplist(3)</code> function
78 can be used to get the group membership list of a user in a <i>much</i>
79 faster way. However, use of this function can have strange interactions
80 with NSS modules, depending on the NSS modules used (see
81 <a href="http://bugs.proftpd.org/show_bug.cgi?id=3475">Bug#3475</a>).
82 Use this option to disable use of the <code>getgrouplist(3)</code>
83 function, <i>e.g.</i>:
84 <pre>
85 AuthUnixOptions NoGetgrouplist
86 </pre>
87 This setting has no effect on systems which do not support the
88 <code>getgrouplist(3)</code> function.
89 </li>
90
91 <p>
92 <li><code>NoInitgroups</code><br>
93 <p>
94 On systems which support it, the <code>initgroups(3)</code> function
95 can be used to get the group membership list of a user in a <i>much</i>
96 faster way. However, there are limits to the number of groups to which
97 a user can belong, use of this function means that groups which exceed
98 that limit <b>will be silently ignored</b>. Thus for sites which need
99 users to belong to a <i>large</i> number of groups, use this option to
100 disable the use of the <code>initgroups(3)</code> function, <i>e.g.</i>:
101 <pre>
102 AuthUnixOptions NoInitgroups
103 </pre>
104 This setting has no effect on systems which do not support the
105 <code>initgroups(3)</code> function.
106 </li>
107 </ul>
108
109 <p>
110 <hr>
111 <h3><a name="PersistentPasswd">PersistentPasswd</a></h3>
112 <strong>Syntax:</strong> PersistentPasswd <em>on|off</em><br>
113 <strong>Default:</strong> off<br>
114 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
115 <strong>Module:</strong> mod_auth_unix<br>
116 <strong>Compatibility:</strong> 1.2.0
117
118 <p>
119 The <code>PersistentPasswd</code> directive controls how
120 <code>mod_auth_unix</code> handles authentication, user/group lookups, and
121 user/group to name mapping. If set to <em>on</em>, <code>mod_auth_unix</code>
122 will attempt to open the system-wide <code>/etc/passwd</code>,
123 <code>/etc/group</code> (and potentially <code>/etc/shadow</code>) files
124 itself, holding them open even during a <code>chroot()</code>ed login. (Note
125 that <code>/etc/shadow</code> is never held open, for security reasons).
126
127 <p>
128 On some platforms, you <b>must</b> turn this option on, as the libc functions
129 are incapable of accessing these databases from inside of a
130 <code>chroot()</code>.
131
132 <p>
133 Note: <code>NIS</code>/<code>NIS+</code> and <code>NSS</code> users will most
134 likely want to disable this feature. Failure to disable this will make your
135 <code>NIS</code>/<code>NIS+</code> maps and <code>NSS</code> lookups not work!
136 On certain systems, you may also need to use the
137 <code>--enable-autoshadow</code> option in order to authenticate both users
138 from <code>NIS</code> maps or <code>NSS</code> lookups, and local users.
139
140 <p>
141 <hr>
142 <h2><a name="Installation">Installation</a></h2>
143 The <code>mod_auth_unix</code> module is compiled by default.
144
145 <p>
146 <b>Logging</b><br>
147 The <code>mod_auth_unix</code> module supports <a href="../howto/Tracing.html">trace logging</a>, via the module-specific log channels:
148 <ul>
149 <li>auth.unix
150 </ul>
151 Thus for trace logging, to aid in debugging, you would use the following in
152 your <code>proftpd.conf</code>:
153 <pre>
154 TraceLog /path/to/ftpd/trace.log
155 Trace auth.unix:20
156 </pre>
157 This trace logging can generate large files; it is intended for debugging use
158 only, and should be removed from any production configuration.
159
160 <p><a name="FAQ">
161 <b>Frequently Asked Questions</b><br>
162
163 <p><a name="Password8Characters">
164 <font color=red>Question</font>: I found that only the first 8 characters of
165 passwords are used! This is a security bug!<br>
166 <font color=blue>Answer</font>: No, it is not.
167
168 <p>
169 The default Unix password hashing scheme uses the <a href="http://en.wikipedia.org/wiki/Data_Encryption_Standard">Data Encryption Standard</a> (DES) algorithm.
170 As per the <code>crypt(3)</code> man page, <b>only the first 8 characters
171 of the password are used</b>. Thus this 8 character limitation comes from
172 the underlying system authentication, <b>not</b> from proftpd. The whole
173 purpose of the PAM system was to enable replacing the use of DES with other
174 authentication algorithms, which do not have this 8 character limitation.
175
176 <p>
177 Later, other <code>crypt(3)</code> implementations were made which can also
178 support algorithms such as MD5, or Blowfish. Some platforms support these
179 enhanced versions of <code>crypt(3)</code>, some do not.
180
181 <p><a name="ExpiredPasswords">
182 <font color=red>Question</font>: It appears that the handling of expired
183 passwords by <code>mod_auth_unix</code> is wrong. Is this a bug?<br>
184 <font color=blue>Answer</font>: Not really. Different implementations
185 have implemented expired passwords differently. One particular implementation
186 even has special values, <i>e.g.</i> for the date of last password change:
187 <blockquote>
188 The value 0 has a special meaning, which is that the user should
189 change her password the next time she will log in the system.
190 </blockquote>
191
192 <p>
193 These special cases vary from implementation to implementation; in the end,
194 it is better to use the
195 <a href="mod_auth_pam.html"><code>mod_auth_pam</code></a> module and a PAM
196 configuration which can better handle password expiration according to your
197 site's needs.
198
199 <p><a name="CachedUsers">
200 <font color=red>Question</font>: I've added new user to my system (<i>i.e.</i>
201 in the <code>/etc/passwd</code> file), but my <code>proftpd</code> does not
202 see the new user until I have restarted it. Is there any way to not have
203 to restart <code>proftpd</code>, to disable its caching of system users?<br>
204 <font color=blue>Answer</font>: ProFTPD is not caching system users, per se.
205 Instead, this behavior is a side-effect of the
206 <a href="#PersistentPasswd"><code>PersistentPasswd</code></a> setting. Check
207 to see if you have:
208 <pre>
209 PersistentPasswd on
210 </pre>
211 in your <code>proftpd.conf</code>. If you do (or if you do not have
212 <code>PersistentPasswd</code> in your config at all), then change your
213 <code>proftpd.conf</code> to have:
214 <pre>
215 PersistentPasswd off
216 </pre>
217
218 <p>
219 Why is this necessary? When you use <code>PersistentPasswd on</code>,
220 then <code>proftpd</code> will open a <i>file descriptor</i> on the system
221 <code>/etc/passwd</code> file during server startup. This descriptor is kept
222 open during the lifetime of the daemon. Later, when you add a new user to the
223 system <code>/etc/passwd</code> file, the system tools create a new version of
224 that file, then rename the new file to have the <code>/etc/passwd</code> name.
225 But <code>proftpd</code> still has a descriptor to the <i>old</i> file, and
226 does not see/know that the file has changed. That is why it can look like
227 <code>proftpd</code> is "caching" your system users.
228
229 <p><a name="DeleteViaPasswd">
230 <font color=red>Question</font>: I recently deleted a user's password using:
231 <pre>
232 $ passwd -d <em>user</em>
233 </pre>
234 This successfully prevented the user from logging in via <code>ssh</code>,
235 but they <i>were</i> able to successfully login using <code>proftpd</code>.
236 This is a bug, right?<br>
237 <font color=blue>Answer</font>: No, not really. It's more of a nasty gotcha.
238
239 <p>
240 Per the <code>passwd(1)</code> man page, the <code>-d</code> option does not
241 do what you might assume/think it does:
242 <pre>
243 -d
244 This is a quick way to delete a password for an account. It will set
245 the named account passwordless. Available to root only.
246 </pre>
247 Thus the <code>-d</code> option only <i>deletes the password</i>; it does
248 <b>not</b> lock the account by setting a password of "*", and it does <b>not</b>
249 delete the account/entry. Rather than using <code>passwd -d</code>, I would
250 strongly recommend using <code>passwd -l</code> (to <em>lock</em> the account),
251 or <code>userdel(8)</code> or equivalent (to <em>remove</em> the account
252 entirely).
253
254 <p>
255 The issue then is that <code>proftpd</code> does not <b>require</b> that
256 clients provide non-empty passwords by default. Thus a client providing
257 an empty string as the password for a so-called "deleted" account would be
258 able to successfully log in. To address this, there is the
259 <a href="./mod_auth.html#AllowEmptyPasswords"><code>AllowEmptyPasswords</code></a> directive. For example, setting this in your <code>proftpd.conf</code>
260 should make using <code>passwd -d</code> work as you'd expect:
261 <pre>
262 &lt;Global&gt;
263 AllowEmptyPassword off
264 &lt;/Global&gt;
265 </pre>
266
267 <p>
268 <hr><br>
269
270 <font size=2><b><i>
271 &copy; Copyright 2010-2015 The ProFTPD Project<br>
272 All Rights Reserved<br>
273 </i></b></font>
274 <hr>
275
276 </body>
277 </html>