| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>ProFTPD module mod_ls</title> |
| 5 | </head> |
| 6 | |
| 7 | <body bgcolor=white> |
| 8 | |
| 9 | <hr> |
| 10 | <center> |
| 11 | <h2><b>ProFTPD module <code>mod_ls</code></b></h2> |
| 12 | </center> |
| 13 | <hr><br> |
| 14 | |
| 15 | <p> |
| 16 | The <code>mod_ls</code> module handles the <code>LIST</code>, |
| 17 | <code>NLST</code>, and <code>STAT</code> FTP commands. |
| 18 | |
| 19 | <h2>Directives</h2> |
| 20 | <ul> |
| 21 | <li><a href="#DirFakeGroup">DirFakeGroup</a> |
| 22 | <li><a href="#DirFakeMode">DirFakeMode</a> |
| 23 | <li><a href="#DirFakeUser">DirFakeUser</a> |
| 24 | <li><a href="#ListOptions">ListOptions</a> |
| 25 | <li><a href="#ListStyle">ListStyle</a> |
| 26 | <li><a href="#ShowSymlinks">ShowSymlinks</a> |
| 27 | <li><a href="#UseGlobbing">UseGlobbing</a> |
| 28 | </ul> |
| 29 | |
| 30 | <hr> |
| 31 | <h3><a name="DirFakeGroup">DirFakeGroup</a></h3> |
| 32 | <strong>Syntax:</strong> DirFakeGroup <em>off|on [display-name]</em><br> |
| 33 | <strong>Default:</strong> None<br> |
| 34 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code>, <code><Anonymous></code>, <code><Directory></code>, .ftpaccess<br> |
| 35 | <strong>Module:</strong> mod_ls<br> |
| 36 | <strong>Compatibility:</strong> All versions |
| 37 | |
| 38 | <p> |
| 39 | The <code>DirFakeGroup</code> directive can be used to hide the true group |
| 40 | ownership of files (including directories, FIFOs, <i>etc</i>) in directory |
| 41 | listings. If simply turned <em>on</em>, <code>DirFakeGroup</code> will display |
| 42 | all files as being owned by group "ftp". Optionally, the <em>display-name</em> |
| 43 | parameter can be used to specify a group other than "ftp". A |
| 44 | <em>display-name</em> of "~" can be used as the parameter, in order to display |
| 45 | the primary group name of the current user. |
| 46 | |
| 47 | <p> |
| 48 | Both <code>DirFakeGroup</code> and |
| 49 | <a href="#DirFakeUser"><code>DirFakeUser</code></a> are <b>completely |
| 50 | cosmetic</b>; the <em>display-names</em> configured do <b>not</b> need to exist |
| 51 | on the system, and neither directive affects permissions, real ownership or |
| 52 | access control <em>in any way</em>. |
| 53 | |
| 54 | <p> |
| 55 | <hr> |
| 56 | <h3><a name="DirFakeMode">DirFakeMode</a></h3> |
| 57 | <strong>Syntax:</strong> DirFakeMode <em>display-mode</em><br> |
| 58 | <strong>Default:</strong> None<br> |
| 59 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code>, <code><Anonymous></code>, <code><Directory></code>, .ftpaccess<br> |
| 60 | <strong>Module:</strong> mod_ls<br> |
| 61 | <strong>Compatibility:</strong> All versions |
| 62 | |
| 63 | <p> |
| 64 | The <code>DirFakeMode</code> directive configures the <em>mode</em> (or |
| 65 | permissions) which will be displayed for <b>all</b> files and directories in |
| 66 | directory listings. For each subset of permissions (<i>i.e.</i> user, group, |
| 67 | other), the "execute" permission for directories is added in listings if the |
| 68 | "read" permission is specified by this directive. |
| 69 | |
| 70 | <p> |
| 71 | As with <a href="#DirFakeUser"><code>DirFakeUser</code></a>, and |
| 72 | <a href="#DirFakeGroup"><code>DirFakeGroup</code></a>, the "fake" permissions |
| 73 | shown in directory listings are <b>cosmetic only</b>; they do not affect real |
| 74 | permissions or access control <em>in any way</em> on the server. Note, |
| 75 | however, that <code>DirFakeMode</code> <i>can</i> affect the real permissions, |
| 76 | for example, for FTP mirroring tools. Such tools tend to create a mirror from |
| 77 | what the tool sees (<i>e.g.</i> <code>DirFakeMode</code> permissions) on the |
| 78 | source FTP server. |
| 79 | |
| 80 | <p> |
| 81 | Examples: |
| 82 | <pre> |
| 83 | # Display everything as read-only |
| 84 | DirFakeMode 0444 |
| 85 | </pre> |
| 86 | |
| 87 | <p> |
| 88 | <hr> |
| 89 | <h3><a name="DirFakeUser">DirFakeUser</a></h3> |
| 90 | <strong>Syntax:</strong> DirFakeUser <em>off|on [display-name]</em><br> |
| 91 | <strong>Default:</strong> None<br> |
| 92 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code>, <code><Anonymous></code>, <code><Directory></code>, .ftpaccess<br> |
| 93 | <strong>Module:</strong> mod_ls<br> |
| 94 | <strong>Compatibility:</strong> All versions |
| 95 | |
| 96 | <p> |
| 97 | The <code>DirFakeUser</code> directive can be used to hide the true user |
| 98 | ownership of files (including directories, FIFOs, <i>etc</i>) in directory |
| 99 | listings. If simply turned <em>on</em>, <code>DirFakeUser</code> will display |
| 100 | all files as being owned by user "ftp". Optionally, the <em>display-name</em> |
| 101 | parameter can be used to specify a user other than "ftp". A |
| 102 | <em>display-name</em> parameter of "~" can be used in order to display the name |
| 103 | of the current user. |
| 104 | |
| 105 | <p> |
| 106 | Both <a href="#DirFakeGroup"><code>DirFakeGroup</code></a> and |
| 107 | <code>DirFakeUser</code> are <b>completely cosmetic</b>; the |
| 108 | <em>display-names</em> specified do <b>not</b> need to exist on the system, |
| 109 | and neither directive affects permissions, real ownership or access control |
| 110 | <em>in any way</em>. |
| 111 | |
| 112 | <p> |
| 113 | <hr> |
| 114 | <h3><a name="ListOptions">ListOptions</a></h3> |
| 115 | <strong>Syntax:</strong> ListOptions <em>options [strict [maxdepth depth] [maxfiles count] [maxdirs count] [LISTOnly] [NLSTOnly] [NoErrorIfAbsent] [AdjustedSymlinks] [SortedNLST]</em><br> |
| 116 | <strong>Default:</strong> None<br> |
| 117 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code>, <code><Anonymous></code>, <code><Directory></code>, .ftpaccess<br> |
| 118 | <strong>Module:</strong> mod_ls<br> |
| 119 | <strong>Compatibility:</strong> 1.2.8rc1 and later |
| 120 | |
| 121 | <p> |
| 122 | The <code>ListOptions</code> directive is used to configure various optional |
| 123 | behavior of <code>mod_ls</code>. <b>Note</b>: all of the configured |
| 124 | <code>ListOptions</code> parameters <b>must</b> appear on the same line in the |
| 125 | configuration; only the <i>first</i> <code>ListOptions</code> directive that |
| 126 | appears in the configuration is used. |
| 127 | |
| 128 | <p> |
| 129 | The currently supported <em>flags</em> are: |
| 130 | <ul> |
| 131 | <li><code>LISTOnly</code><br> |
| 132 | <p> |
| 133 | This <em>flag</em> tells <code>mod_ls</code> to apply the |
| 134 | <code>ListOptions</code> configuration only to FTP <code>LIST</code> |
| 135 | commands, and not to <i>e.g.</i> <code>NLST</code>/<code>STAT</code> |
| 136 | commands. |
| 137 | </li> |
| 138 | |
| 139 | <p> |
| 140 | <li><code>NLSTOnly</code><br> |
| 141 | <p> |
| 142 | This <em>flag</em> tells <code>mod_ls</code> to apply the |
| 143 | <code>ListOptions</code> configuration only to FTP <code>NLST</code> |
| 144 | commands, and not to <i>e.g.</i> <code>LIST</code>/<code>STAT</code> |
| 145 | commands. |
| 146 | </li> |
| 147 | |
| 148 | <p> |
| 149 | <li><code>NoErrorIfAbsent</code><br> |
| 150 | <p> |
| 151 | This <em>flag</em> tells <code>mod_ls</code> to return the FTP 226 |
| 152 | response code for <code>LIST</code>/<code>NLST</code> commands for |
| 153 | files/paths which do not exist, rather than returning the 450 error |
| 154 | code. |
| 155 | </li> |
| 156 | |
| 157 | <p> |
| 158 | <li><code>AdjustedSymlinks</code><br> |
| 159 | <p> |
| 160 | This <em>flag</em> tells <code>mod_ls</code> to try to automatically |
| 161 | adjust any symlink destination paths when the FTP session is chrooted, |
| 162 | so that the adjusted symlinks work properly <i>e.g.</i> for FTP clients. |
| 163 | |
| 164 | <p> |
| 165 | <b>Note</b> that this <em>flag</em> first appeared in |
| 166 | <code>proftpd-1.3.7rc1</code>. |
| 167 | </li> |
| 168 | |
| 169 | <p> |
| 170 | <li><code>SortedNLST</code><br> |
| 171 | <p> |
| 172 | By default, <code>mod_ls</code> returns <code>NLST</code> results |
| 173 | in an <em>unordered</em> list, <i>i.e.</i> the sort order used by the |
| 174 | underlying filesystem and the <code>readdir(3)</code> library function. |
| 175 | Some FTP clients, however, may want/expect to have <code>NLST</code> |
| 176 | results sorted alphabetically. Use this flag to achieve that sorted |
| 177 | <code>NLST</code> behavior. |
| 178 | |
| 179 | <p> |
| 180 | <b>Note</b> that this <em>flag</em> first appeared in |
| 181 | <code>proftpd-1.3.6rc3</code>. |
| 182 | </li> |
| 183 | </ul> |
| 184 | |
| 185 | <p> |
| 186 | See also: <a href="../howto/ListOptions.html">ListOptions</a> |
| 187 | |
| 188 | <p> |
| 189 | <hr> |
| 190 | <h3><a name="ListStyle">ListStyle</a></h3> |
| 191 | <strong>Syntax:</strong> ListStyle <em>Unix|Windows</em><br> |
| 192 | <strong>Default:</strong> <code>ListStyle Unix</code><br> |
| 193 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code>, <code><Anonymous></code><br> |
| 194 | <strong>Module:</strong> mod_ls<br> |
| 195 | <strong>Compatibility:</strong> 1.3.8rc1 and later |
| 196 | |
| 197 | <p> |
| 198 | The <code>ListStyle</code> directive can be used to emit Windows-style directory |
| 199 | listings for the <code>LIST</code> command, rather than default Unix-style |
| 200 | directory listings. This is mainly to support certain FTP clients which only |
| 201 | expect/support the Windows-style listings. |
| 202 | |
| 203 | For example, using: |
| 204 | <pre> |
| 205 | ListStyle Windows |
| 206 | </pre> |
| 207 | leads to a directory listing like this, for the basic command-line |
| 208 | <code>ftp(1)</code> Unix client: |
| 209 | <pre> |
| 210 | ftp> ls |
| 211 | 229 Entering Extended Passive Mode (|||57644|) |
| 212 | 150 Opening ASCII mode data connection for file list |
| 213 | 11-30-15 07:29PM <DIR> a_folder |
| 214 | 11-30-15 07:29PM 16 file |
| 215 | 226 Transfer complete |
| 216 | </pre> |
| 217 | |
| 218 | <p> |
| 219 | <hr> |
| 220 | <h3><a name="ShowSymlinks">ShowSymlinks</a></h3> |
| 221 | <strong>Syntax:</strong> ShowSymlinks <em>on|off</em><br> |
| 222 | <strong>Default:</strong> <code>ShowSymlinks on</code><br> |
| 223 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code>, <code><Anonymous></code><br> |
| 224 | <strong>Module:</strong> mod_ls<br> |
| 225 | <strong>Compatibility:</strong> All versions |
| 226 | |
| 227 | <p> |
| 228 | The <code>ShowSymlinks</code> directive configures whether symbolic links are |
| 229 | displayed as such in directory listings, or whether they are not displayed |
| 230 | to the client. If <code>ShowSymlinks</code> is <em>off</em>, then the linked |
| 231 | file's permissions and ownership are used in the directory listing. |
| 232 | |
| 233 | <p> |
| 234 | <hr> |
| 235 | <h3><a name="UseGlobbing">UseGlobbing</a></h3> |
| 236 | <strong>Syntax:</strong> UseGlobbing <em>on|off</em><br> |
| 237 | <strong>Default:</strong> <code>UseGlobbing on</code><br> |
| 238 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code>, <code><Anonymous></code><br> |
| 239 | <strong>Module:</strong> mod_ls<br> |
| 240 | <strong>Compatibility:</strong> 1.2.5rc1 and later |
| 241 | |
| 242 | <p> |
| 243 | The <code>UseGlobbing</code> directive controls the use of <code>glob(3)</code> |
| 244 | functionality, which is needed for supporting wildcard characters such as "*" |
| 245 | in directory listing requests from FTP clients. |
| 246 | |
| 247 | <p> |
| 248 | The <code>glob(3)</code> functionality in FTP servers has been knowwn to |
| 249 | cause security issues (see <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-0249">CVE-2001-0249</a>), thus should be disabled when not needed. |
| 250 | |
| 251 | <p> |
| 252 | Examples: |
| 253 | <pre> |
| 254 | # Turn off support for globs in LIST/NLST commands |
| 255 | UseGlobbing off |
| 256 | </pre> |
| 257 | |
| 258 | <p> |
| 259 | <hr> |
| 260 | <h2><a name="Installation">Installation</a></h2> |
| 261 | The <code>mod_ls</code>module is <b>always</b> installed. |
| 262 | |
| 263 | <p><a name="FAQ"> |
| 264 | <b>Frequently Asked Questions</b><br> |
| 265 | |
| 266 | <p><a name="NLSTNamesOnly"> |
| 267 | <font color=red>Question</font>: I have a legacy FTP application which sends |
| 268 | the <code>NLST</code> command, and expects to receive <i>only</i> file |
| 269 | <em>names</em>, without any directory prefix (relative or absolute). I cannot |
| 270 | change this application. How can I configure ProFTPD to return only names |
| 271 | for the <code>NLST</code> command?<br> |
| 272 | <font color=blue>Answer</font>: You can use the |
| 273 | <a href="#ListOptions"><code>ListOptions</code></a> directive to achieve |
| 274 | this, like so: |
| 275 | <pre> |
| 276 | # We want only names, no hidden files, and only for NLST |
| 277 | ListOptions '-A -1 NLSTOnly' |
| 278 | </pre> |
| 279 | |
| 280 | <p> |
| 281 | <hr><br> |
| 282 | |
| 283 | <font size=2><b><i> |
| 284 | © Copyright 2000-2020 The ProFTPD Project<br> |
| 285 | All Rights Reserved<br> |
| 286 | </i></b></font> |
| 287 | |
| 288 | <hr><br> |
| 289 | </body> |
| 290 | </html> |