mod_ls
The mod_ls module handles the LIST, NLST, and STAT FTP commands.
LIST
NLST
STAT
<VirtualHost>
<Global>
<Anonymous>
<Directory>
The DirFakeGroup directive can be used to hide the true group ownership of files (including directories, FIFOs, etc) in directory listings. If simply turned on, DirFakeGroup will display all files as being owned by group "ftp". Optionally, the display-name parameter can be used to specify a group other than "ftp". A display-name of "~" can be used as the parameter, in order to display the primary group name of the current user.
DirFakeGroup
Both DirFakeGroup and DirFakeUser are completely cosmetic; the display-names configured do not need to exist on the system, and neither directive affects permissions, real ownership or access control in any way.
DirFakeUser
The DirFakeMode directive configures the mode (or permissions) which will be displayed for all files and directories in directory listings. For each subset of permissions (i.e. user, group, other), the "execute" permission for directories is added in listings if the "read" permission is specified by this directive.
DirFakeMode
As with DirFakeUser, and DirFakeGroup, the "fake" permissions shown in directory listings are cosmetic only; they do not affect real permissions or access control in any way on the server. Note, however, that DirFakeMode can affect the real permissions, for example, for FTP mirroring tools. Such tools tend to create a mirror from what the tool sees (e.g. DirFakeMode permissions) on the source FTP server.
Examples:
# Display everything as read-only DirFakeMode 0444
The DirFakeUser directive can be used to hide the true user ownership of files (including directories, FIFOs, etc) in directory listings. If simply turned on, DirFakeUser will display all files as being owned by user "ftp". Optionally, the display-name parameter can be used to specify a user other than "ftp". A display-name parameter of "~" can be used in order to display the name of the current user.
Both DirFakeGroup and DirFakeUser are completely cosmetic; the display-names specified do not need to exist on the system, and neither directive affects permissions, real ownership or access control in any way.
The ListOptions directive is used to configure various optional behavior of mod_ls. Note: all of the configured ListOptions parameters must appear on the same line in the configuration; only the first ListOptions directive that appears in the configuration is used.
ListOptions
The currently supported flags are:
LISTOnly
This flag tells mod_ls to apply the ListOptions configuration only to FTP LIST commands, and not to e.g. NLST/STAT commands.
NLSTOnly
This flag tells mod_ls to apply the ListOptions configuration only to FTP NLST commands, and not to e.g. LIST/STAT commands.
NoErrorIfAbsent
This flag tells mod_ls to return the FTP 226 response code for LIST/NLST commands for files/paths which do not exist, rather than returning the 450 error code.
AdjustedSymlinks
This flag tells mod_ls to try to automatically adjust any symlink destination paths when the FTP session is chrooted, so that the adjusted symlinks work properly e.g. for FTP clients.
Note that this flag first appeared in proftpd-1.3.7rc1.
proftpd-1.3.7rc1
SortedNLST
By default, mod_ls returns NLST results in an unordered list, i.e. the sort order used by the underlying filesystem and the readdir(3) library function. Some FTP clients, however, may want/expect to have NLST results sorted alphabetically. Use this flag to achieve that sorted NLST behavior.
readdir(3)
Note that this flag first appeared in proftpd-1.3.6rc3.
proftpd-1.3.6rc3
See also: ListOptions
ListStyle Unix
The ListStyle directive can be used to emit Windows-style directory listings for the LIST command, rather than default Unix-style directory listings. This is mainly to support certain FTP clients which only expect/support the Windows-style listings. For example, using:
ListStyle
ListStyle Windows
ftp(1)
ftp> ls 229 Entering Extended Passive Mode (|||57644|) 150 Opening ASCII mode data connection for file list 11-30-15 07:29PM <DIR> a_folder 11-30-15 07:29PM 16 file 226 Transfer complete
ShowSymlinks on
The ShowSymlinks directive configures whether symbolic links are displayed as such in directory listings, or whether they are not displayed to the client. If ShowSymlinks is off, then the linked file's permissions and ownership are used in the directory listing.
ShowSymlinks
UseGlobbing on
The UseGlobbing directive controls the use of glob(3) functionality, which is needed for supporting wildcard characters such as "*" in directory listing requests from FTP clients.
UseGlobbing
glob(3)
The glob(3) functionality in FTP servers has been knowwn to cause security issues (see CVE-2001-0249), thus should be disabled when not needed.
# Turn off support for globs in LIST/NLST commands UseGlobbing off
Frequently Asked Questions Question: I have a legacy FTP application which sends the NLST command, and expects to receive only file names, without any directory prefix (relative or absolute). I cannot change this application. How can I configure ProFTPD to return only names for the NLST command? Answer: You can use the ListOptions directive to achieve this, like so: # We want only names, no hidden files, and only for NLST ListOptions '-A -1 NLSTOnly' © Copyright 2000-2020 The ProFTPD Project All Rights Reserved
Question: I have a legacy FTP application which sends the NLST command, and expects to receive only file names, without any directory prefix (relative or absolute). I cannot change this application. How can I configure ProFTPD to return only names for the NLST command? Answer: You can use the ListOptions directive to achieve this, like so:
# We want only names, no hidden files, and only for NLST ListOptions '-A -1 NLSTOnly'