> For the complete documentation index, see [llms.txt](https://notes.cavementech.com/pentesting-quick-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.cavementech.com/pentesting-quick-reference/linux-basics/linenum.md).

# LinEnum

LinEnum is a bash script that is used by penetration testers to automate local enumeration and identify privilege escalation vectors on Linux systems.

To use this script, you will need to copy the script into your lab environment. To begin with, you can access the script through the following GitHub repository:

{% embed url="<https://github.com/rebootuser/LinEnum>" %}

On the GitHub repo, navigate to the LinEnum.sh script as shown in the following screenshot.

<figure><img src="https://assets.ine.com/lab/learningpath/75d644399f48aa28ed4dfb4eec7703f715e8bee19f7ccd717971fad13c5558df.png" alt=""><figcaption></figcaption></figure>

You will then need to view the script in raw format, this can be done by clicking the raw button as shown in the following screenshot.

<figure><img src="https://assets.ine.com/lab/learningpath/e66271eb9fd261c8120e453183000e3aada71289145ab208aaa280eacd0c157e.png" alt=""><figcaption></figcaption></figure>

You will now need to copy the content of the script in raw format and paste it into the lab environment clipboard.

<figure><img src="https://assets.ine.com/lab/learningpath/f4c6144f42f3da81986f287c072b45de4e30b598e2d69355b66e4de309e57ff1.png" alt=""><figcaption></figcaption></figure>

Once you have copied the script from the GitHub repo, navigate back to the Kali Linux system in your lab environment and create a new file with a text editor like leafpad.

Then paste in the script you copied in the file, after which save the file as LinEnum.sh as shown in the following screenshots.

<figure><img src="https://assets.ine.com/lab/learningpath/9be44e631d53db366a5296fec02b086141c0d4b6784cf76cdec0f7d55f73a856.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://assets.ine.com/lab/learningpath/f4730824542b152a42ae50418fc6b73f878fce772b5818d6eb81235be0c434ca.png" alt=""><figcaption></figcaption></figure>

We can now navigate back to our meterpreter session and navigate to the tmp drive by running the following command:

**Command:**

```
cd /tmp
```

We can now upload the *LinEnum.sh* script we copied from the GitHub repo by running the following command:

**Command:**

```
upload /root/Desktop/LinEnum.sh
```

<figure><img src="https://assets.ine.com/lab/learningpath/e4117df12d4d9ed02fa2cf58c2091e6d0ac900702f1108efcc75800669cad871.png" alt=""><figcaption></figcaption></figure>

We will now need to spawn a command shell session, this can be done by running the following command:

**Command:**

```
shell
```

**Command:**

```
/bin/bash -i
```

We can now run the LinEnum.sh script by running the following commands:

**Command:**

```
chmod +x LinEnum.sh
```

**Command:**

```
./LinEnum.sh
```

<figure><img src="https://assets.ine.com/lab/learningpath/26c05f6e1dfeb562b7d37c2012477868a0cb26a91f2aac29351d220c48171c57.png" alt=""><figcaption></figcaption></figure>

As shown in the following screenshot, the LinEnum.sh script will run and will display the results in the terminal.

<figure><img src="https://assets.ine.com/lab/learningpath/27623b42bf0e39878636bd75e819f270c1b26960ddc63aa7b53d2c4d2d79a9b9.png" alt=""><figcaption></figcaption></figure>

Take a few minutes to go through the output and analyze what information LinEnum was able to enumerate in addition to any potentially interesting information that we were unable to enumerate manually or with Metasploit modules.

## Conclusion

In this lab, we explored automating local enumeration on a Linux system by leveraging Metasploit post-exploitation modules and local enumeration scripts like LinEnum.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://notes.cavementech.com/pentesting-quick-reference/linux-basics/linenum.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
