Created
December 12, 2025 08:37
-
-
Save Muminur/ce16da0787d64a8b2f6635409fb459ec to your computer and use it in GitHub Desktop.
Reset Ubuntu password without knowing the root password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ๐ Proxmox VE: How to Reset Forgotten Ubuntu VM/LXC Password | |
| This guide covers the methods for resetting a forgotten user or root password for an Ubuntu guest system installed on Proxmox Virtual Environment (PVE). | |
| --- | |
| ## ๐ Method 1: For Linux Containers (LXC) - Easiest | |
| If your Ubuntu guest is an **LXC Container**, you can change the password directly from the Proxmox Host shell as the container shares the kernel. | |
| 1. Log in to your **Proxmox Host** via SSH or use the PVE Web GUI's **Shell** tab. | |
| 2. Run the following commands, replacing `101` with your container's ID and `your_username` with the user you want to reset. | |
| ```bash | |
| # 1. Enter the running container environment | |
| pct enter 101 | |
| # 2. Change the password for a specific user | |
| passwd your_username | |
| # 3. Enter the new password twice when prompted | |
| # 4. Exit the container shell | |
| exit | |
| ``` | |
| 3. You can now log in to the container using the new password. | |
| --- | |
| ## ๐ ๏ธ Method 2: For Virtual Machines (VM) - Standard GRUB Edit | |
| This is the standard procedure for resetting a password in a full Ubuntu VM by using the **GRUB boot loader** to access a root shell. | |
| ### 1. Access the GRUB Menu | |
| 1. Go to the **Console** tab of your Ubuntu VM in the Proxmox GUI. | |
| 2. Click **Reboot**. | |
| 3. **Immediately** press and hold the **`Shift`** key (or tap **`Esc`** repeatedly) as the VM starts to force the display of the GRUB boot menu. | |
| ### 2. Edit Boot Parameters | |
| 1. Use the arrow keys to highlight the default **Ubuntu** boot entry. | |
| 2. Press the **`e`** key to edit the boot configuration. | |
| 3. Scroll down to the long line that starts with **`linux`** (or `linuxefi`). | |
| 4. Find the section containing the boot mode (e.g., `ro quiet splash` or `ro maybe-ubiquity`). | |
| 5. **DELETE** this section and replace it with: | |
| ```bash | |
| rw init=/bin/bash | |
| ``` | |
| **Example of the change (Do NOT delete the `linux` line, only edit the bolded part):** | |
| | Before (Original Line End) | After (Edited Line End) | | |
| | :--- | :--- | | |
| | `... root=UUID=xxxx ro quiet splash` | `... root=UUID=xxxx` **`rw init=/bin/bash`** | | |
| 6. Press **`Ctrl` + `X`** or **`F10`** to boot the system using the modified command. | |
| ### 3. Reset the Password | |
| The VM will boot directly into a root command line shell (`#`). | |
| 1. Reset the password for your user (replace `your_username`): | |
| ```bash | |
| passwd your_username | |
| ``` | |
| 2. Enter and confirm your new password when prompted. | |
| ### 4. Reboot | |
| Once the password has been successfully reset, reboot the system to apply the changes permanently: | |
| ```bash | |
| exec /sbin/init |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment