What is Directory Listing?
Directory listing is a feature which list the contents of a directory if there is no index file (e.g. index.php or index.html) present in that directory. So, once directory listing is enabled and if that directory is not having any index files, when a request is made to that directory, the web server will sends a directory listing as a response even if there are sensitive files from a web application.
What are the drawbackups of Directory Listing?
When ‘Directory listings’ is enabled it will display any content present in that specif document root path or directory. when you place a file within this directory, it means it is publicly accessible, and we need to set permissions to prevent retrieval by unwanted users.
Simply viewing the names of files and subdirectories present in your directory which is exposed very bad since hackers will eventually find your directory listings, especially if there is sensitive content or configuration. If your directories like “/admin” or “/etc” or “/var” directories is publicly accessible, your server may become compromised.
If you are intending to use Directory Listings on your server, be very careful not to place sensitive content into them and also make sure you have set permissions correctly to prevent retrieval of sensitive content that may exist.
cPanel lists all the files and directories of the website by default and you can also disable directory listing of the website by choosing No indexes and this article will guide you in that.
Step1: Login to your cPanel.
Step2: Click on the icon ‘Indexes’ under ‘ADVANCED’ section.
Step3: Select the directory for whose directory listing you need to disable.
Step4: From the newly opened, you can Select the ‘No Indexing’ option to disable directory listing and click save:
Note: The various options available there are:
Default System Indexing: The Default option which is set by your host.
No Indexing: Option to disable directory listing.
Standard Indexing: This option will enable the directory listing for your directory.
Fancy Indexing: This option will also enable the directory listing. The end user will see the name and description of the files and directories under your directory.