How to list all the directories to apache #apache #directory #listingofthedirectories #linux #files #folders #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**


```bash

sudo apt update && sudo apt install apache2 -y

```


---


## **2️⃣ Enable the `autoindex` Module**


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


```bash

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:


```bash

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

```


Change:


```apache

DocumentRoot /var/www/html

```


to:


```apache

DocumentRoot /

```


Or point to another folder, e.g.:


```apache

DocumentRoot /home/yourusername

```


---


## **4️⃣ Allow Directory Listing in Apache Config**


Edit:


```bash

sudo nano /etc/apache2/apache2.conf

```


Add at the bottom:


```apache

<Directory />

    Options Indexes FollowSymLinks

    AllowOverride None

    Require all granted

</Directory>

```


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


---


## **5️⃣ Restart Apache**


```bash

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