| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>ProFTPD module mod_facts</title> |
| 5 | </head> |
| 6 | |
| 7 | <body bgcolor=white> |
| 8 | |
| 9 | <hr> |
| 10 | <center> |
| 11 | <h2><b>ProFTPD module <code>mod_facts</code></b></h2> |
| 12 | </center> |
| 13 | <hr><br> |
| 14 | |
| 15 | <p> |
| 16 | <b>File "Facts" Support</b><br> |
| 17 | |
| 18 | <p> |
| 19 | The <code>mod_facts</code> module is ProFTPD's module for handling the |
| 20 | <code>MLSD</code> and <code>MLST</code> commands, in support of |
| 21 | <a href="http://www.faqs.org/rfcs/rfc3659.html">RFC 3659</a>. In addition, |
| 22 | the <code>mod_facts</code> module implements the <code>MFF</code> and |
| 23 | <code>MFMT</code> commands defined in: |
| 24 | <pre> |
| 25 | <a href="http://tools.ietf.org/html/draft-somers-ftp-mfxx-04">http://tools.ietf.org/html/draft-somers-ftp-mfxx-04</a> |
| 26 | </pre> |
| 27 | |
| 28 | <p> |
| 29 | This module is contained in the <code>mod_facts.c</code> file for |
| 30 | ProFTPD 1.3.<i>x</i>, and is compiled by default. Other installation |
| 31 | instructions are discussed <a href="#Installation">here</a>. |
| 32 | |
| 33 | <p> |
| 34 | The most current version of <code>mod_facts</code> can be found in the |
| 35 | ProFTPD source distribution: |
| 36 | <pre> |
| 37 | <a href="http://www.proftpd.org/">http://www.proftpd.org/</a> |
| 38 | </pre> |
| 39 | |
| 40 | <h2>Directives</h2> |
| 41 | <ul> |
| 42 | <li><a href="#FactsAdvertise">FactsAdvertise</a> |
| 43 | <li><a href="#FactsDefault">FactsDefault</a> |
| 44 | <li><a href="#FactsOptions">FactsOptions</a> |
| 45 | </ul> |
| 46 | |
| 47 | <hr> |
| 48 | <h3><a name="FactsAdvertise">FactsAdvertise</a></h3> |
| 49 | <strong>Syntax:</strong> FactsAdvertise <em>on|off</em><br> |
| 50 | <strong>Default:</strong> FactsAdvertise on<br> |
| 51 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 52 | <strong>Module:</strong> mod_facts<br> |
| 53 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 54 | |
| 55 | <p> |
| 56 | The <code>FactsAdvertise</code> directive is used to control whether |
| 57 | the <code>mod_facts</code> module advertises its <code>MLST</code> support |
| 58 | via the <code>FEAT</code> command. |
| 59 | |
| 60 | <p> |
| 61 | By default, the <code>mod_facts</code> module will list <code>MLST</code> |
| 62 | in the <code>FEAT</code> response. FTP clients use this to determine whether |
| 63 | to use the newer <code>MLSD</code>/<code>MLST</code> commands, or the older |
| 64 | <code>LIST</code>/<code>NLST</code> commands. Some FTP clients, though, |
| 65 | will attempt to use the newer commands just as if they were equivalent to |
| 66 | the older commands, including supporting glob/wildcard characters. |
| 67 | Section 2.2.2 of RFC3659, which explicitly states that wildcard characters are |
| 68 | <b>not</b> supported in the <code>MLSD</code> and <code>MLST</code> commands. |
| 69 | Thus, to prevent problems when using such FTP clients with proftpd, |
| 70 | you can disable the advertising of support for those commands using |
| 71 | <i>e.g.</i> the following in your <code>proftpd.conf</code>: |
| 72 | <pre> |
| 73 | <IfModule mod_facts.c> |
| 74 | FactsAdvertise off |
| 75 | </IfModule> |
| 76 | </pre> |
| 77 | |
| 78 | <hr> |
| 79 | <h3><a name="FactsAdvertise">FactsDefault</a></h3> |
| 80 | <strong>Syntax:</strong> FactsDefault <em>fact1 ...</em><br> |
| 81 | <strong>Default:</strong> None</br> |
| 82 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 83 | <strong>Module:</strong> mod_facts<br> |
| 84 | <strong>Compatibility:</strong> 1.3.8rc3 and later |
| 85 | |
| 86 | <p> |
| 87 | The <code>FactsDefault</code> directive configures the default list of facts |
| 88 | to include in responses to <code>MLSD</code>/<code>MLST</code> FTP commands. |
| 89 | |
| 90 | The supported <em>fact</em> names are: |
| 91 | <ul> |
| 92 | <li><code>media-type</code> (file media type, where known) |
| 93 | <li><code>modify</code> (file modification timestamp) |
| 94 | <li><code>perm</code> (file permissions) |
| 95 | <li><code>size</code> (file size in bytes) |
| 96 | <li><code>type</code> (file type, per <a href="https://datatracker.ietf.org/doc/html/rfc3659#section-7.5.1">RFC 3659, Section 7.5.1</a>) |
| 97 | <li><code>unique</code> (unique file identifier) |
| 98 | <li><code>UNIX.group</code> (file numeric UNIX group ID) |
| 99 | <li><code>UNIX.groupname</code> (file textual UNIX group name) |
| 100 | <li><code>UNIX.mode</code> (file numeric UNIX permissions/mode) |
| 101 | <li><code>UNIX.owner</code> (file numeric UNIX user ID) |
| 102 | <li><code>UNIX.ownername</code> (file textual UNIX user name) |
| 103 | </ul> |
| 104 | |
| 105 | <p> |
| 106 | By default, the <code>mod_facts</code> module will provide the following facts: |
| 107 | <ul> |
| 108 | <li><code>modify</code> |
| 109 | <li><code>perm</code> |
| 110 | <li><code>size</code> |
| 111 | <li><code>type</code> |
| 112 | <li><code>unique</code> |
| 113 | <li><code>UNIX.group</code> |
| 114 | <li><code>UNIX.groupname</code> |
| 115 | <li><code>UNIX.mode</code> |
| 116 | <li><code>UNIX.owner</code> |
| 117 | <li><code>UNIX.ownername</code> |
| 118 | </ul> |
| 119 | |
| 120 | <hr> |
| 121 | <h3><a name="FactsOptions">FactsOptions</a></h3> |
| 122 | <strong>Syntax:</strong> FactsOptions <em>opt1 ...</em><br> |
| 123 | <strong>Default:</strong> None<br> |
| 124 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 125 | <strong>Module:</strong> mod_facts<br> |
| 126 | <strong>Compatibility:</strong> 1.3.4b and later |
| 127 | |
| 128 | <p> |
| 129 | The <code>FactsOptions</code> directive is used to configure various optional |
| 130 | behavior of <code>mod_facts</code>. <b>Note</b>: all of the configured |
| 131 | <code>FactsOptions</code> parameters <b>must</b> appear on the same line in the |
| 132 | configuration; only the <i>first</i> <code>FactsOptions</code> directive that |
| 133 | appears in the configuration is used. |
| 134 | |
| 135 | <p> |
| 136 | The currently implemented options are: |
| 137 | <ul> |
| 138 | <li><code>UseSlink</code><br> |
| 139 | <p> |
| 140 | Use this option to have <code>mod_facts</code> use the <i>broken</i> |
| 141 | "OS.unix=slink" syntax, preferred by FTP clients such as FileZilla, for |
| 142 | indicating symlinks, rather than the more correct "OS.unix=symlink" |
| 143 | syntax. See |
| 144 | <a href="http://bugs.proftpd.org/show_bug.cgi?id=3318">Bug#3318</a> for |
| 145 | a more detailed discussion. |
| 146 | |
| 147 | <p> |
| 148 | <b>Note</b> that this option first appeared in |
| 149 | <code>proftpd-1.3.4b</code>. |
| 150 | </li> |
| 151 | |
| 152 | <p> |
| 153 | <li><code>AdjustedSymlinks</code><br> |
| 154 | <p> |
| 155 | Using this option will cause <code>mod_facts</code> to try to automatically |
| 156 | adjust any symlink destination paths when the FTP session is chrooted, so |
| 157 | that the adjusted symlinks work properly <i>e.g.</i> for FTP clients. |
| 158 | |
| 159 | <p> |
| 160 | <b>Note</b> that this option first appeared in |
| 161 | <code>proftpd-1.3.7rc1</code>. |
| 162 | </li> |
| 163 | |
| 164 | <p> |
| 165 | <li><code>NoNames</code><br> |
| 166 | <p> |
| 167 | By default, <code>mod_facts</code> will automatically use the newer |
| 168 | <code>UNIX.ownername</code> and <code>UNIX.groupname</code> facts in its |
| 169 | <code>MLSD</code>/<code>MLST</code> responses. But some FTP clients may |
| 170 | not react well to the presence of these facts. Use this option to disable |
| 171 | to use of these facts. |
| 172 | |
| 173 | <p> |
| 174 | <b>Note</b> that this option first appeared in |
| 175 | <code>proftpd-1.3.6rc3</code>. |
| 176 | </li> |
| 177 | </ul> |
| 178 | |
| 179 | <p><a name="FAQ"> |
| 180 | <b>Frequently Asked Questions</b><br> |
| 181 | |
| 182 | <p><a name="FactsListOptions"> |
| 183 | <font color=red>Question</font>: Why does <code>MLSD</code> list all of the |
| 184 | files in a directory, including the "hidden" files, where the <code>LIST</code> |
| 185 | command does not?<br> |
| 186 | <font color=blue>Answer</font>: The <code>MLSD</code> and <code>MLST</code> |
| 187 | commands do not have any notions of "options" like the <code>LIST</code> and |
| 188 | <code>NLST</code> commands do; there is no way for a client, in the request |
| 189 | to list the files in a directory, to ask the server to filter the list of |
| 190 | files somehow. Instead, <code>MLSD</code> contains a list of "facts" for |
| 191 | each file in its list; the client then has to to decide how to filter the |
| 192 | list of files based on those facts. This is why the <code>ListOptions</code> |
| 193 | directive has no influence over the <code>MLSD</code> and <code>MLST</code> |
| 194 | commands. |
| 195 | |
| 196 | <p><a name="FactsUIDs"> |
| 197 | <font color=red>Question</font>: Why does <code>MLST</code> show the UIDs/GIDs |
| 198 | for listed files, where <code>LIST</code>/<code>NLST</code> show the user/group |
| 199 | names?<br> |
| 200 | <font color=blue>Answer</font>: The list of "facts" defined by RFC 3659 does |
| 201 | <b>not</b> include a fact for the stringified version of user/group owner |
| 202 | names, unfortunately. This means that the <code>MLSD</code>/<code>MLST</code> |
| 203 | commands do not have a good way of obtaining the user/group names. |
| 204 | |
| 205 | <p> |
| 206 | To work around this issue, you can add the following to your |
| 207 | <code>proftpd.conf</code>: |
| 208 | <pre> |
| 209 | <IfModule mod_facts.c> |
| 210 | FactsAdvertise off |
| 211 | </IfModule> |
| 212 | </pre> |
| 213 | This tells <code>proftpd</code> to not advertise to the client that it can |
| 214 | support the <code>MLSD</code>/<code>MLST</code> commands. The client will then |
| 215 | usually fall back to using the older <code>LIST</code> command, which |
| 216 | <i>does</i> include the file owner user/group names. |
| 217 | |
| 218 | <p><a name="FactsSymlinks"> |
| 219 | <font color=red>Question</font>: Why does FileZilla not display symlinks |
| 220 | properly, even though I have "ShowSymlinks on" in my <code>proftpd.conf</code>?<br> |
| 221 | <font color=blue>Answer</font>: Newer versions of FileZilla (and other |
| 222 | FTP clients) use the <code>MLSD</code> command for listing files, rather than |
| 223 | the older <code>LIST</code> command. And FileZilla and the |
| 224 | <code>mod_facts</code> module disagree on the proper syntax for indicating when |
| 225 | a file is a symlink. |
| 226 | |
| 227 | <p> |
| 228 | To work around this issue, you can add the following to your |
| 229 | <code>proftpd.conf</code>: |
| 230 | <pre> |
| 231 | <IfModule mod_facts.c> |
| 232 | FactsOptions UseSlink |
| 233 | </IfModule> |
| 234 | </pre> |
| 235 | This tells the <code>mod_facts</code> module to use the improper |
| 236 | "OS.unix=slink:<i>path</i>" syntax for symlinks; this is the syntax preferred |
| 237 | by FileZilla (and perhaps other FTP clients). By default, the |
| 238 | <code>mod_facts</code> module uses the better "OS.unix=symlink" syntax. |
| 239 | |
| 240 | <p> |
| 241 | <b>Note</b> that if you are running <code>proftpd-1.3.3</code>, however, |
| 242 | the <code>FactsOptions</code> directive is not supported. To get FileZilla |
| 243 | to display symlinks properly for older proftpd versions, then, you would use: |
| 244 | <pre> |
| 245 | <IfModule mod_facts.c> |
| 246 | FactsAdvertise off |
| 247 | </IfModule> |
| 248 | </pre> |
| 249 | This tells the <code>mod_facts</code> module to <b>not</b> advertise that it |
| 250 | supports the newer <code>MLST/MLSD</code> commands. FileZilla will then fall |
| 251 | back to using the older directory list commands (<i>i.e.</i> <code>LIST</code>, |
| 252 | <code>NLST</code>), which should show symlinks properly. |
| 253 | |
| 254 | <p><a name="FactsDotfiles"> |
| 255 | <font color=red>Question</font>: How can I hide dotfiles (<i>e.g.</i> ".msg") |
| 256 | from the <code>MLSD</code> command?<br> |
| 257 | <font color=blue>Answer</font>: There are two possible ways of dealing |
| 258 | with FTP clients which use the <code>MLSD</code> command for listing |
| 259 | directories, as opposed to the <code>LIST</code>/<code>NLST</code> commands. |
| 260 | |
| 261 | <p> |
| 262 | Since the <code>MLSD</code> command does not have the concept of "options", |
| 263 | unlike <code>LIST</code>/<code>NLST</code>, the <code>ListOptions</code> |
| 264 | directive does not apply to <code>MLSD</code> as some would expect. Thus |
| 265 | using a configuration like so: |
| 266 | <pre> |
| 267 | ListOptions +a |
| 268 | </pre> |
| 269 | to hide dotfiles from <code>LIST</code> commands does <b>not</b> work for |
| 270 | <code>MLSD</code>. How, then, to hide dotfiles from MLSD commands? You can |
| 271 | configure proftpd so that it does not advertise the fact that it can support |
| 272 | the <code>MLSD</code> command, via: |
| 273 | <pre> |
| 274 | <IfModule mod_facts.c> |
| 275 | FactsAdvertise off |
| 276 | </IfModule> |
| 277 | </pre> |
| 278 | Alternatively, you can use the <code>HideFiles</code> and |
| 279 | <code>IgnoreHidden</code> directives: |
| 280 | <pre> |
| 281 | <Directory /> |
| 282 | # Hide files whose names start with "." |
| 283 | HideFiles ^\. |
| 284 | |
| 285 | <Limit LIST MLSD NLST> |
| 286 | # Do not include hidden files for LIST, MLSD, and NLST |
| 287 | IgnoreHidden on |
| 288 | </Limit> |
| 289 | </Directory> |
| 290 | </pre> |
| 291 | This latter configuration will apply to <code>LIST</code>, <code>NLST</code>, |
| 292 | and <code>MLSD</code> equally. |
| 293 | |
| 294 | <p><a name="FactsRemove"> |
| 295 | <font color=red>Question</font>: How can I disable the <code>mod_facts</code> |
| 296 | module entirely? Some clients (<i>e.g.</i> ncftp) do not appear to implement |
| 297 | <code>MLSD</code> properly, and do not honor the <code>FEAT</code> response from |
| 298 | <code>proftpd</code> when <code>FactsAdvertise</code> is configured |
| 299 | <em>off</em>.<br> |
| 300 | <font color=blue>Answer</font>: There is no easy way of disabling the |
| 301 | <code>mod_facts</code> module at present; the |
| 302 | <a href="#FactsAdvertise"><code>FactsAdvertise</code></a> directive is intended |
| 303 | to do this in a way compliant with the RFCs. |
| 304 | |
| 305 | <p> |
| 306 | That said, you <i>can</i> compile <code>proftpd</code> such that |
| 307 | <code>mod_facts</code> is built as a DSO/shared module: |
| 308 | <pre> |
| 309 | $ ./configure --enable-dso --with-shared=mod_facts ... |
| 310 | </pre> |
| 311 | and then, in your <code>proftpd.conf</code>, you simply omit any |
| 312 | "LoadModule mod_facts.c" directive, so that that module is never dynamically |
| 313 | loaded. |
| 314 | |
| 315 | <p> |
| 316 | <hr> |
| 317 | <h2><a name="Installation">Installation</a></h2> |
| 318 | The <code>mod_facts</code> module is distributed with ProFTPD, and is |
| 319 | normally compiled as a static module by default. However, if you wish to |
| 320 | have <code>mod_facts</code> be built as a shared module, you would use: |
| 321 | <pre> |
| 322 | $ ./configure --enable-dso --with-shared=mod_facts ... |
| 323 | </pre> |
| 324 | Then follow the usual steps: |
| 325 | <pre> |
| 326 | $ make |
| 327 | $ make install |
| 328 | </pre> |
| 329 | |
| 330 | <p> |
| 331 | <hr> |
| 332 | <font size=2><b><i> |
| 333 | © Copyright 2007-2020 The ProFTPD Project<br> |
| 334 | All Rights Reserved<br> |
| 335 | </i></b></font> |
| 336 | <hr> |
| 337 | |
| 338 | </body> |
| 339 | </html> |