Linux boot password change

How to Reset or Change the Root Password in Linux

In Linux, root privileges (or root access) refers to a user account that has full access to all files, applications, and system functions.

Most basic Linux user accounts run with limited privileges. This keeps users from making mistakes or accidentally exposing the system to vulnerabilities.

To use protected operating system features, a Linux user has to temporarily elevate their privileges using a command like sudo . The sudo command tells the system to run a command as a superuser, or root user. When you run a function using sudo , you’ll usually have to enter your password.

Some versions of Linux will elevate your user privileges for a set amount of time around (15 minutes) before reverting. Other versions only perform a single task with elevated privileges.

It’s a good idea to change your passwords regularly and consider using enterprise password management software.

This guide will help you change your Linux root password in Ubuntu or CentOS, or reset the password.

restart or change root password in linux

Changing Your Root Password in Ubuntu

Step 1: Open a Terminal Window

Right-click the desktop, then left-click Open in terminal.

Alternately, you can click Menu > Applications > Accessories > Terminal.

Step 2: Change Your Root Password

In the terminal window, type the following:

The system will prompt you to enter your password – this is the same password you use to log in to the system.

Next, the system will prompt you to enter a new password. Do so, and then re-enter it exactly the same when the system prompts you to retype the password. This double-entry confirms that you have typed the password correctly.

change root password in ubuntu terminal command

Resetting a Root Password in Ubuntu

In some situations, you may need to access an account for which you’ve lost or forgotten a password.

Step 1: Boot to Recovery Mode

Restart your system. Once you see the splash screen for the computer manufacturer, hold down the shift key. The system should come up with a black and white GRUB, or boot menu, with different Linux kernel versions displayed.

Select the second one from the top – the highest revision, followed by (recovery mode). Press Enter.

Step 2: Drop Out to Root Shell

The system should display a menu with different boot options. Use the arrow keys to navigate to the option labeled root and press Enter.

The system should respond by giving you a command-line interface with a prompt.

Читайте также:  System clear no linux

Step 3: Remount the File System with Write-Permissions

Right now, your system only has read-only access to your system. That means it can look at the data, but cannot make any changes. But we need write-access to change the password, so we’ll need to remount the drive with the appropriate permissions.

Press Enter. This should allow you to make changes to the data on the hard drive.

Step 4: Change the Password

Substitute the name of the user for username, then press Enter. The system asks you to type a new UNIX password and then to retype it.

Once you’ve entered and confirmed the new password, reboot the system by entering the following:

Hit Enter, and your system should restart. Don’t press any keys, let the system come up to the login screen, and test to make sure the new password works.

Note: Learn how to use the chpasswd command. Chpasswd is helpful for managing multiple passwords and making multiple changes.

Changing the Root Password in CentOS

Changing a password in CentOS is almost identical to changing it in Ubuntu.

Step 1: Access the Command Line (Terminal)

Right-click the desktop, then left-click Open in Terminal. Or, click Menu > Applications > Utilities > Terminal.

Step 2: Change the Password

At the prompt, type the following, then press Enter:

The system should prompt you to enter your existing password. Do so, then follow the prompts to enter and confirm a new root password.

change root password in centos

Reset Root Password in CentOS

This is a similar process as in Ubuntu, with a couple of variations.

Step 1: Access Boot Menu

Restart the system, then tap the Esc key about once per second to launch the GRUB menu.

Step 2: Edit Boot Options

Use the arrows to highlight the version of Linux you boot into, then press e.

Use the arrows to highlight the line that starts with kernel or Linux.

At the end of the line, add a space then type single. Press Enter, then boot into single-user mode by pressing Ctrl-X or B. (The system will display the command to use.)

Step 3: Remount the Drive

You should have a command line, and you’ll have root privileges. To enable read/write access on your hard drive, type the following:

Step 4: Changing the Password

Press Enter, and the system should prompt you to enter and confirm a new password.

Step 5: Restart

Type the following, pressing enter after each line:

Your system should restart. Confirm that your new password works by logging in.

Note: If you ever come across a Linux boot failure, be sure to save our guide on using GRUB rescue to troubleshoot it.

If you already have access to your user account, resetting or changing your password in Linux is simple.

It can be more challenging if you’ve lost or forgotten a password, but with a little creative restarting and editing, you shouldn’t find it too hard.

Sofija Simic is an experienced Technical Writer. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations.

In Linux, special tools were developed for managing applications. Application software for Linux typically.

The find command is a useful command-line tool in Linux. It allows you to use the terminal to search for a .

Читайте также:  Linux добавить точку монтирования

There’s a reason that tech support asks you if you’ve rebooted your Linux server. It’s cliched but true.

This guide is for users who have already configured a CentOS server and installed the Apache HTTP services.

Источник

How to Change or Reset Root Password in Linux

If you have not logged in as a root user for a long time and have not saved the login information anywhere, there is a chance that you may lose access to the credentials for your system. It is not an unusual occurrence, but rather, a common issue, which most Linux users have probably encountered before. If this happens, you can easily change or reset the password via the command-line or the GUI (Graphical User Interface).

But what do you do if the root password must be modified or reset?

This article shows you how to change the root password for your Linux Mint 20 system via three different methods.

Note: To change the root password, you must have either the current root password, sudo privileges, or have physical access to the system. It is also recommended to save the new password(s) in a secure location to be accessed when needed.

In this article, we will cover how to:

  1. Change or reset root password as root user
  2. Change or reset root password as sudo user
  3. Change or reset root password using GRUB menu

It is worth mentioning that all the commands included in this article have been tested in the Linux Mint 20 system. These commands have been performed in the Terminal, which can be opened using the Ctrl+Alt+T key shortcut, or by clicking on the terminal icon present in the taskbar of the Linux system.

Change or Reset Root Password as Root User

If you have the current root password and want to reset it, you can do so by using the ‘passwd’ command. Perform the following steps to change or reset the root user password:

First, log in as a root user using the following command in Terminal:

When you are asked to provide the password, enter the current root password. Next, you will see the Terminal prompt changed to ‘#,’ indicating that you are now logged in as the root user.

To change the root password, type the following command in the Terminal:

You will be prompted to enter a new root password. Type the new password and hit the Enter key. Then, re-enter the password and press the Enter key to avoid any typos.

After entering the password, you will be shown a message saying that the password has been updated successfully.

Change or Reset Root Password as Sudo User

The root password can also be changed by a standard user with sudo privileges. You can change or reset the root user password by following the steps given below:

Type the following command as a sudo user in the Terminal to change the root password.

You will be asked to type a new password for the root user. Enter a new password and press Enter. Then, re-enter the password and press the Enter key to avoid any typos.

After entering the password, you will be shown a message saying that the password has been updated successfully.

Читайте также:  Установка alt linux lvm

Change or Reset Root Password Using GRUB Menu

If you are a root user and have forgotten the root password to your system, then you can reset the root password using the GRUB menu. GRUB is the first program that starts at system boot. However, keep in mind that physical access to your system is required to use the method described in this section.

To reset or change the root password using the GRUB menu, perform the following steps:

Restart the system and hold the Shift key or press the Esc key to enter into safe mode (recovery mode). Once you have entered safe mode, you will see the GRUB menu, as shown in the following screenshot.

Next, navigate to the Advanced options.

Then, to switch to the edit window, click ‘e’ on the keyboard.

You will see the following screen:

Scroll down the screen until you see the following line:

“linux / boot / vmlinuz-5.4.0- 26 -generic root = UUID = 35 \2d26aa-051e
-4dbe-adb2-7fbb843f6581 ro quiet splash”

Replace ‘ro‘ with ‘rw’ in the above line and, at the end of the line, append ‘init=/bin/bash’. It should now look like this:

“linux / boot / vmlinuz-5.4.0- 26 -generic root = UUID = 35 \
2d26aa-051e-4dbe-adb2-7fbb843f6581 rw quiet splash init = / bin / bash ”

Adding ‘rw’ and ‘init=/bin/bash’ in the above line basically tells the system to log in to bash with read/write privileges. Note that this configuration will only apply for the current boot, not for subsequent boots.

Now, use the F10 key or the Ctrl+X shortcut to boot up to a command prompt, as shown in the following screenshot.

In the command prompt that appears, type the following command:

You will be prompted for the root password. Input the root password and press the Enter key. Then, retype the password and press Enter to avoid any typos.

Note: You can change not only the root password but also any user’s password using this process.

After entering the password, you will then see a message stating that the new password has been updated.

Finally, use the Ctrl+Alt+Delete shortcut or type the following command at the command prompt to exit and reboot your system.

That is all you need to do to change or reset the root password of your Linux Mint 20 system without the sudo or root login. It is good practice to change the password frequently after some time, especially if you think it has been compromised.

Conclusion

In this article, we have identified three different methods to modify or reset the root password on your system. You can opt for any method, based on the privileges you have. If you have the root password or sudo privileges, you can easily reset the root password using the simple ‘passwd’ command. Otherwise, you can use the GRUB menu to change the root password, but only if you have physical access to the system.

I hope this article has helped you in changing or resetting the root password of your system.

About the author

Aqsa Yasin

I am a self-motivated information technology professional with a passion for writing. I am a technical writer and love to write for all Linux flavors and Windows.

Источник

Оцените статью
Adblock
detector