How to Change Root Password in Linux
In case you remember the current root password
Open a terminal window. To open this window, press Ctrl+ Alt+ T, to open a new terminal window containing Command Prompt (command line interpreter) in most Linux desktop environments.
If you're not using the desktop environment, you're already using Command Prompt, so go to the next step.
Type suin Command Prompt, then press ↵ Enter. The line Password:will open below the Command Prompt.
Type in your current root password, then press ↵ Enter. Once the password is approved, you will return to Command Prompt as the root user.
If you type the wrong password, run suand try again.
Passwords are case sensitive.
Type passwdand press ↵ Enter. The line Enter new UNIX password:will appear below the Prompt.
Type a new password and press ↵ Enter. The password you type will not appear on the screen.
Re-type the new password and press ↵ Enter. You will see the message 'password updated successfully'.
Type exitand press ↵ Enter. This step helps you log out of the root account.
In case you don't remember the current root password
Restart the computer.
Click Ein the Grub menu. The Grub menu appears immediately after you turn on your computer. Normally, this menu only appears on the screen for a while.
If you can't press it Ebefore the Grub menu disappears, you'll need to restart your computer and try again.
This method can be applied to most popular Linux distributions (such as Ubuntu, CentOS 7, Debian). There are many Linux distributions available, some of which are not very well known. If you cannot switch to single-user mode using this method, you will need to visit your distribution's website for specific instructions for your system.
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 begin with linux16instead of linux.
Move the cursor to the end of the line. Press the →, ←, ↑, and keys ↓to place the cursor immediately after ro.
Type init=/bin/bashlater ro. Now the end of the line looks like this:
ro init=/bin/bash
.
Notice the space between ro
and init=/bin/bash
.
Press Ctrl+X . This step causes the system to boot directly as a root-level Command Prompt in single user mode.
Type mount –o remount,rw /in Prompt and press ↵ Enter. This step helps mount the file system in read-write mode.
Type passwdin Prompt and press ↵ Enter. When booting in single user mode, you will have root access, so there is no need to write any additional parameters to the command passwd.
Type in the new root password and press ↵ Enter. The characters you type will not be displayed on the screen. This is normal.
Re-type the new password and press ↵ Enter. When the system confirms that you have re-entered the correct previous password, you will see 'password updated successfully'.
Type reboot –fand press ↵ Enter. This command helps restart the system normally.
You should read it
- How to Become Root in Ubuntu
- How to Become Root in Linux
- How to set and change a user password in Linux
- How to Get Full Root Privileges in Linux
- 8 best Linux password managers
- Use Guestfish to reset the forgotten root password for the virtual machine in qcow2 format on KVM
- 2 steps to change Linksys wifi password
- How to change your computer, phone and Mac passwords
May be interested
- 2 steps to change Linksys wifi passwordif you find that your home wi-fi connection is slowing down recently, even if the charges are increasing for unknown reasons, then it is possible that your home wi-fi network has been stolen. the only solution is to quickly change your wifi password. in the article below, we will guide you to change linksys wifi password. please consult.
- Error on macOS allows creating root account without passwordrecently, an error in the latest version of macos high sierra allows users to create a root account without a password by repeatedly clicking on the button in the options panel.
- How to change your computer, phone and Mac passwordschanging a new password (password) on your computer and phone will help you absolutely protect your data and prevent unauthorized people from accessing it when you're not around.
- How to change VNPT WiFi passwordchange vnpt wifi password you need to pay attention to the type of modem you are using, depending on each vnpt modem but how to change the wifi pass vnpt is also different. here are the specific instructions for you guys.
- How to change Apple ID password?in the following article, we will walk you through the basic steps to change your apple id account information, which is used to access and use mac services for the user community.
- Linux Error SUDO allows you to run commands as roota flaw in the sudo linux command has been discovered, which may allow non-privileged users to execute commands as root.
- How to manage user passwords from Terminal in Linuxlike many things on linux, passwords are easily managed directly from the command line. the passwd utility is designed to allow you to quickly and easily access all password-related commands on the system. you can use it to change and manage your password and other user passwords on the system
- Instructions for changing Viettel WiFi modem passwordthe operation of changing viettel wifi password is essential, to be able to secure personal wifi, as well as to ensure the internet connection speed is stable.
- Change your Facebook password on your phone, how to change mk fbchanging your facebook password on your phone is not the same as changing the pass face on your computer, because the facebook interface on the web and on the mobile app is a bit different. below tipsmake.com will guide you how to change your facebook password on the phone application.
- Learn the file system and folders on Linux operating systemslinux and unix file systems are organized in a hierarchy similar to the structure of a hierarchical tree. the highest level of the file system is the root directory, denoted by a slash '/' (root directory).