How to list all the directories to apache #linux #files #folders #apache

If you want Apache on Kali Linux to show a list of all files and folders in a directory (like an index), you need to enable directory listing in Apache’s configuration.

Here’s how you can do it step-by-step:


---

1️⃣ Install Apache

sudo apt update && sudo apt install apache2 -y


---

2️⃣ Enable the autoindex Module

Apache hides directory contents by default. You need to enable:

sudo a2enmod autoindex


---

3️⃣ Point Apache to the Folder You Want to List

Let’s say you want to share all files of your Kali root (/) —
⚠️ Be careful — this will expose everything to anyone who can access it.

Edit the Apache default site:

sudo nano /etc/apache2/sites-enabled/000-default.conf

Change:

DocumentRoot /var/www/html

to:

DocumentRoot /

Or point to another folder, e.g.:

DocumentRoot /home/yourusername


---

4️⃣ Allow Directory Listing in Apache Config

Edit:

sudo nano /etc/apache2/apache2.conf

Add at the bottom:

<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

If you used /home/yourusername instead of /, change <Directory /> accordingly.


---

5️⃣ Restart Apache

sudo systemctl restart apache2


---

6️⃣ Access in Browser

Local:

http://localhost/

From another device (LAN):

http://<your_kali_ip>/

Permission
sudo chmod +x /home/maverick
sudo chmod -R 755 /home/maverick

---

If you want, I can make you a Kali Apache config that lists all files and folders with download links but hides sensitive system directories — so you can explore files without exposing dangerous stuff.
Do you want me to prepare that safer version?


Comments