• About
  • Contact
  • Cookie
  • Disclaimer
  • Privacy Policy
  • Change the purpose of use

Tnhelearning.edu.vn - Various useful general information portal

  • Photo
  • Bio
  • How To
  • Tech

How to Change Root Password in Linux

February 10, 2024 by admin Category: How To

You are viewing the article How to Change Root Password in Linux  at Tnhelearning.edu.vn you can quickly access the necessary information in the table of contents of the article below.

X

This article is co-authored by a team of editors and trained researchers who confirm the accuracy and completeness of the article.

The wikiHow Content Management team carefully monitors the work of editors to ensure that every article is up to a high standard of quality.

This article has been viewed 14,239 times.

This wikiHow teaches you how to change the root password in Linux, if you remember your current password or can’t remember your root password.

Table of Contents

  • Steps
    • In case of remembering the current root password
    • In case you do not remember the current root password
  • Advice

Steps

In case of remembering the current root password

Image titled Change the Root Password in Linux Step 1

Image titled Change the Root Password in Linux Step 1

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/8/8d/Change-the-Root-Password-in-Linux-Step-1-Version-3.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-1-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/8/8d/Change-the- Root-Password-in-Linux-Step-1-Version-3.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-1-Version-3.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Open a terminal window. To open this window, press Ctrl + Alt + T , [1] X Research Source to open a new terminal window with Command Prompt (command line interpreter) in most Linux desktop environments.

  • If you’re not using a desktop environment, you’re already using the Command Prompt, so proceed to the next step.
Image titled Change the Root Password in Linux Step 2

Image titled Change the Root Password in Linux Step 2

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/3/39/Change-the-Root-Password-in-Linux-Step-2-Version-3.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-2-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/3/39/Change-the- Root-Password-in-Linux-Step-2-Version-3.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-2-Version-3.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Type su in the Command Prompt, and then press ↵ Enter . [2] X Research SourcePassword: will open below Command Prompt.
Image titled Change the Root Password in Linux Step 3

Image titled Change the Root Password in Linux Step 3

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/5/5f/Change-the-Root-Password-in-Linux-Step-3-Version-3.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-3-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/5/5f/Change-the- Root-Password-in-Linux-Step-3-Version-3.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-3-Version-3.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Type the current root password, then press ↵ Enter . Once the password is approved, you will return to the Command Prompt as the root user.

  • If you typed the wrong password, run su and try again.
  • Passwords are case sensitive.
READ More:   How to Remove Eyebrow Dye
Image titled Change the Root Password in Linux Step 4

Image titled Change the Root Password in Linux Step 4

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/0/04/Change-the-Root-Password-in-Linux-Step-4-Version-3.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-4-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/0/04/Change-the- Root-Password-in-Linux-Step-4-Version-3.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-4-Version-3.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Type passwd and press ↵ Enter . The line Enter new UNIX password: will appear at the bottom of the prompt.
Image titled Change the Root Password in Linux Step 5

Image titled Change the Root Password in Linux Step 5

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/9/9d/Change-the-Root-Password-in-Linux-Step-5-Version-3.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-5-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/9/9d/Change-the- Root-Password-in-Linux-Step-5-Version-3.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-5-Version-3.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Type the new password and press ↵ Enter . The password you type will not appear on the screen.
Image titled Change the Root Password in Linux Step 6

Image titled Change the Root Password in Linux Step 6

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/7/7f/Change-the-Root-Password-in-Linux-Step-6-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-6-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/7/7f/Change-the- Root-Password-in-Linux-Step-6-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-6-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Retype the new password and press ↵ Enter . You will see the message “password updated successfully”.
Image titled Change the Root Password in Linux Step 7

Image titled Change the Root Password in Linux Step 7

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/c/c6/Change-the-Root-Password-in-Linux-Step-7-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-7-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/c/c6/Change-the- Root-Password-in-Linux-Step-7-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-7-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Type exit and press ↵ Enter . This step helps you to log out of the root account.

In case you do not remember the current root password

Image titled Change the Root Password in Linux Step 8

Image titled Change the Root Password in Linux Step 8

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/0/07/Change-the-Root-Password-in-Linux-Step-8-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-8-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/0/07/Change-the- Root-Password-in-Linux-Step-8-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-8-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Restart the computer.
Image titled Change the Root Password in Linux Step 9

Image titled Change the Root Password in Linux Step 9

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/f/f8/Change-the-Root-Password-in-Linux-Step-9-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-9-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/f/f8/Change-the- Root-Password-in-Linux-Step-9-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-9-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Press E in the Grub menu. [3] X Research Sources The Grub menu appears as soon as you turn on your computer. Usually, this menu only appears on the screen for a while.

  • If you can’t press E before the Grub menu disappears, you’ll need to restart your computer and try again.
  • This method can be applied with most popular Linux distributions (such as Ubuntu, CentOS 7, Debian). There are many Linux distributions available, some of which are unknown. If you can’t switch to single-user mode this way, you’ll need to visit your distro’s website for instructions specific to your system.
Image titled Change the Root Password in Linux Step 10

Image titled Change the Root Password in Linux Step 10

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/3/39/Change-the-Root-Password-in-Linux-Step-10-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-10-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/3/39/Change-the- Root-Password-in-Linux-Step-10-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-10-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Scroll down to the line starting with linux /boot . Press the ↑ and ↓ keys to do this. You need to edit this line to boot in single user mode.

  • In CentOS and some other distributions, the command line may start with linux16 instead of linux .
READ More:   How to Identify Broken Mushrooms
Image titled Change the Root Password in Linux Step 11

Image titled Change the Root Password in Linux Step 11

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/8/85/Change-the-Root-Password-in-Linux-Step-11-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-11-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/8/85/Change-the- Root-Password-in-Linux-Step-11-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-11-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Move the cursor to the end of the line. Press the → , ← , ↑ , and ↓ keys to place the cursor immediately after ro .
Image titled Change the Root Password in Linux Step 12

Image titled Change the Root Password in Linux Step 12

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/4/4c/Change-the-Root-Password-in-Linux-Step-12-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-12-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/4/4c/Change-the- Root-Password-in-Linux-Step-12-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-12-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Type init=/bin/bash after ro . Now the end of the line looks like this:
ro init=/bin/bash .

  • Notice the space between ro and init=/bin/bash .
Image titled Change the Root Password in Linux Step 13

Image titled Change the Root Password in Linux Step 13

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/0/03/Change-the-Root-Password-in-Linux-Step-13-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-13-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/0/03/Change-the- Root-Password-in-Linux-Step-13-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-13-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Press Ctrl + X . This step causes the system to boot directly as a root-level Command Prompt in single user mode.
Image titled Change the Root Password in Linux Step 14

Image titled Change the Root Password in Linux Step 14

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/f/f7/Change-the-Root-Password-in-Linux-Step-14-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-14-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/f/f7/Change-the- Root-Password-in-Linux-Step-14-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-14-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Type mount –o remount,rw / into the prompt and press ↵ Enter . This step helps to mount the file system in read-write mode.
Image titled Change the Root Password in Linux Step 15

Image titled Change the Root Password in Linux Step 15

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/8/85/Change-the-Root-Password-in-Linux-Step-15-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-15-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/8/85/Change-the- Root-Password-in-Linux-Step-15-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-15-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Type passwd in the prompt and press ↵ Enter . When you boot in single-user mode, you’ll have root access, so there’s no need to add any extra parameters to the passwd command.
Image titled Change the Root Password in Linux Step 16

Image titled Change the Root Password in Linux Step 16

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/4/4e/Change-the-Root-Password-in-Linux-Step-16-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-16-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/4/4e/Change-the- Root-Password-in-Linux-Step-16-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-16-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Type the new root password and press ↵ Enter . The characters you type will not be displayed on the screen. This is normal.
Image titled Change the Root Password in Linux Step 17

Image titled Change the Root Password in Linux Step 17

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/e/e7/Change-the-Root-Password-in-Linux-Step-17-Version-2.jpg/v4-728px- Change-the-Root-Password-in-Linux-Step-17-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/e/e7/Change-the- Root-Password-in-Linux-Step-17-Version-2.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-17-Version-2.jpg”,”smallWidth”:460 ,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Retype the new password and press ↵ Enter . When the system confirms that you have re-entered the correct password before, you will see the line “password updated successfully”.
  • Image titled Change the Root Password in Linux Step 18

    Image titled Change the Root Password in Linux Step 18

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/e/ee/Change-the-Root-Password-in-Linux-Step-18.jpg/v4-728px-Change-the- Root-Password-in-Linux-Step-18.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/e/ee/Change-the-Root-Password-in-Linux- Step-18.jpg/v4-728px-Change-the-Root-Password-in-Linux-Step-18.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
    Type reboot –f and press ↵ Enter . This command helps to reboot the system normally.
  • Advice

    • Your password should consist of 8 or more characters, a combination of letters (upper and lowercase), numbers, and special characters.
    • To change the password for another user, use su as root and type passwd <username> .
    READ More:   How to Post Videos on Facebook
    X

    This article is co-authored by a team of editors and trained researchers who confirm the accuracy and completeness of the article.

    The wikiHow Content Management team carefully monitors the work of editors to ensure that every article is up to a high standard of quality.

    This article has been viewed 14,239 times.

    This wikiHow teaches you how to change the root password in Linux, if you remember your current password or can’t remember your root password.

    Thank you for reading this post How to Change Root Password in Linux at Tnhelearning.edu.vn You can comment, see more related articles below and hope to help you with interesting information.

    Related Search:

    Related Posts

    How to Create Curved Text in Photoshop
    How to fall asleep faster
    How to Install FBReader to Read eBooks

    Category: How To

    Previous Post: « Top 10+ beautiful and cute baby birthday invitation templates
    Next Post: Touched with the best Central music karaoke songs »

    Copyright © 2025 · Tnhelearning.edu.vn - Useful Knowledge