> For the complete documentation index, see [llms.txt](https://riteshs4hu.gitbook.io/infosec-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://riteshs4hu.gitbook.io/infosec-notes/internal-and-external-network-sec/privilege-escalation/linux/user-enumeration.md).

# User Enumeration

Identifying **which users exist**, **who is logged in**, and **which users have elevated rights** can help identify paths to escalate their privileges.&#x20;

#### **Check Current User**

```bash
whoami
```

```bash
id
```

#### **List All Users**

```bash
cat /etc/passwd
```

* Users with UID ≥ 1000 are usually normal users.
* UID 0 → root.

#### **Check for Sudo Privileges**

```bash
sudo -l
```

* Lists commands the current user can run as root without a password.

#### **Logged-in Users**

```bash
who -a
```

```bash
w
```

#### **Groups and Memberships**

```bash
groups
id
cat /etc/group
```
