Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Change the Root Password in Linux

Learn how to change the root password in linux with clear steps, practical context, and useful troubleshooting guidance.

Table of Contents

This updated guide examines How to Change the Root Password in Linux and organizes the essential facts, background, and practical takeaways in clear American English.

Responsible-use note: Apply security techniques only to systems you own or are explicitly authorized to test.

Method 1of 2:

With the Current Root Password

  1. How to Change the Root Password in Linux — contextual image 1 Open a terminal window. To do so, pressCtrl+Alt+T,[1]which will open a new terminal window with a command prompt in most Linux desktop environments.
    • If you're not using a desktop environment, you're already at a command prompt, so proceed to the next step.
  2. How to Change the Root Password in Linux — contextual image 2 Typesuat the command prompt, and press?Enter. [2]APassword:line will open below the command prompt.
  3. How to Change the Root Password in Linux — contextual image 3 Type the current root password, then press?Enter. When the password is accepted, you'll be brought back to the command prompt as the root user.
    • If you type the password incorrectly, runsuand try again.
    • Passwords are case-sensitive.
  4. How to Change the Root Password in Linux — contextual image 4 Typepasswdand press?Enter. AnEnter new UNIX password:line will appear below the prompt.
  5. How to Change the Root Password in Linux — contextual image 5 Type a new password and press?Enter. The password you type will not appear on the screen.
  6. How to Change the Root Password in Linux — contextual image 6 Retype the new password and press?Enter. You will see a message that reads 'password updated successfully.'
  7. How to Change the Root Password in Linux — contextual image 7 Typeexitand press?Enter. This will log you out of the root account.

Method 2of 2:

Without the Current Root Password

  1. How to Change the Root Password in Linux — contextual image 8 Restart your computer.
  2. How to Change the Root Password in Linux — contextual image 9 PressEat the Grub menu. [3]The Grub menu appears right after you turn on the computer. In most cases, it only stays on the screen for a few moments.
    • If you don't pressEbefore the Grub menu disappears, reboot and try again.
    • This method works for most popular Linux distributions (Ubuntu, CentOS 7, Debian). There are many distributions of Linux, some more obscure than others. If you're not able to get to single-user mode with this method, check your distribution's website for instructions specific to your system.
  3. How to Change the Root Password in Linux — contextual image 10 Scroll to the line that begins withlinux /boot. Use the?and?keys to do so. This is the line you'll need to modify to boot into single-user mode.
    • In CentOS and some other distributions, the line may begin withlinux16rather thanlinux.
  4. How to Change the Root Password in Linux — contextual image 11 Move the cursor to the end of the line. Use the?,?,?, and?keys to place the cursor right afterro.
  5. How to Change the Root Password in Linux — contextual image 12 Typeinit=/bin/bashafterro. The end of the line should now look like this: ro init=/bin/bash.
    • Note the space betweenroandinit=/bin/bash.
  6. How to Change the Root Password in Linux — contextual image 13 PressCtrl+X. This tells the system to boot directly to a root-level command prompt in single-user mode.
  7. How to Change the Root Password in Linux — contextual image 14 Typemount –o remount,rw /at the prompt and press?Enter. This mounts the file system in read-write mode.
  8. How to Change the Root Password in Linux — contextual image 15 Typepasswdat the prompt and press?Enter. Since booting into single-user mode gives you root access, there's no need to pass additional parameters to thepasswdcommand.
  9. How to Change the Root Password in Linux — contextual image 16 Type a new root password and press?Enter. The characters you type won't be displayed on the screen. This is normal.
  10. How to Change the Root Password in Linux — contextual image 17 Retype the new password and press?Enter. When the system confirms you've re-entered the same password, you'll see a message that reads 'password updated successfully.'
  11. How to Change the Root Password in Linux — contextual image 18 Typereboot –fand and press?Enter. This command reboots the system normally.

FAQ

What is How to Change the Root Password in Linux about?

It provides a structured overview of password, explains the main context, and highlights practical takeaways for readers.

Why does this topic matter?

Understanding the main concepts helps readers evaluate the issue, avoid common mistakes, and make better-informed decisions.

How should readers use this information?

Use the guidance as a practical starting point, confirm details that may have changed, and follow current product, safety, or security recommendations.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.