search
HomeComputer TutorialsComputer KnowledgeIf you forget your Linux password, you can retrieve it like this

If you forget your Linux password, you can retrieve it like this

Feb 19, 2024 pm 03:40 PM
passwordubunturecovery mode

If you forget your Linux password, you can retrieve it like this

Forgetting your password is one of the situations we often encounter, whether it is on the operating system, website account, mobile phone, email or other channels. Sometimes if a password needs to meet certain complexity requirements, such as containing uppercase letters, lowercase letters, numbers, and special characters, and is long enough, it can become difficult to remember the password, and over time, it can be easy to forget. If you forget your password, you can generally use your mobile phone number to retrieve it. However, if the operating system forgets it, it will be a bit troublesome. Here we will teach you how to retrieve the server password without reinstalling the system.

Ubuntu system forgotten password solution

Recovery mode and single-user mode processing can be used in Ubuntu systems:

Recovery Mode

To reset your Ubuntu system password, you can do it by following these steps: Restart your computer and hold down the Shift key to enter the GRUB menu. Select "Advanced options for Ubuntu" and enter "recovery mode". In recovery mode, select "root" mode and enter the command "passwd yourusername", where yourusername is your username. After entering the new password twice and restarting the system, you can log in using the new password.

Single user mode

When restarting the computer, hold down the Shift key to enter the GRUB menu. Select "Ubuntu, with Linux…" and press the e key to enter edit mode. Add the "recovery nomodeset" parameter at the end of the second to last line and press F10 to enter single-user mode. In single-user mode, run the command passwd yourusername to change the password, and then enter the new password twice. Restart the system and log in with the new password.

General methods for handling forgotten passwords in Linux systems

To restart the Linux system, press the "Shift" key or other designated keys on the keyboard to enter the boot menu. Different Linux distributions and versions may require different keystrokes. If the Shift key does not work, you can try multiple times.

In the boot menu, use the arrow keys to locate the entry labeled "Recovery Mode", "Repair" or similar options, and then press the "Enter" key to enter that mode.

After entering recovery mode, a privileged command line interface called "root shell" or "root console" will appear. On this interface, you can log in as the root user and perform operations that require privileged permissions.

4. In the root console, enter the following command to mount the system's root directory in writable mode:

mount -o remount,rw /

This command remounts the root file system in read-write mode so that you can modify files.

5. List all users to find the username whose password you want to reset. Enter the following command:

ls /home

This command will display the list of users that have been created on the system.

6. Select the username whose password you want to reset and run the following command to change the password. Replace "username" with the actual username you want to reset the password for:

passwd username

After executing this command, the system will ask you to enter a new password. Remember, when entering the password, no characters will be displayed. This is for Linux security reasons.

7. After entering the new password, follow the prompts to re-enter the same password for confirmation.

8. After changing the password, use the following command to remount the root file system in read-only mode to ensure system security:

mount -o remount,ro /

9. Enter the following command to restart the system:

reboot

The system will restart and load the normal login interface. Log in to your account using the new password you just set.

Finally, the specific performance of these steps may vary slightly depending on the Linux distribution and version. If you encounter difficulties or are not sure how to perform certain steps, you need to refer to the documentation of the Linux distribution you are using or the relevant forums for help. Additionally, always ensure that you have sufficient authority and understanding before performing such operations to avoid accidental or irreversible damage.

The above is the detailed content of If you forget your Linux password, you can retrieve it like this. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:每日运维. If there is any infringement, please contact admin@php.cn delete
How to Find and Back up Resident Evil 4 Saves? Here Is a Guide! - MiniToolHow to Find and Back up Resident Evil 4 Saves? Here Is a Guide! - MiniToolApr 14, 2025 am 12:50 AM

Do you wonder how to find Resident Evil 4 saves? How to back up Resident Evil 4 saves? This post from php.cn provides 3 ways for you to back up Resident Evil 4 saves. Now, keep on your reading.

How to Limit the Number of Login Attempts on WindowsHow to Limit the Number of Login Attempts on WindowsApr 14, 2025 am 12:49 AM

If someone tries to access your computer by inputting numerous key combinations, your computer is at a higher risk of being opened. Therefore, it is quite needed to limit the number of login attempts. How to do it? Read this php.cn post.

Cfgmgr32.dll Not Found? Fix the Issue Easily via Simple MethodsCfgmgr32.dll Not Found? Fix the Issue Easily via Simple MethodsApr 14, 2025 am 12:48 AM

Cfgmgr32.dll missing errors often happen to annoy people a lot and leave some more severe issues in your Windows. So, what should you do when you run into the Cfgmgr32.dll not found issue? This post on php.cn Website will tell you some methods.

Fixed: Lock Screen Timeout Is Not WorkingFixed: Lock Screen Timeout Is Not WorkingApr 14, 2025 am 12:47 AM

Have you ever encountered a problem where the Windows lock screen timeout is not working? Fortunately, several feasible solutions are available in this post from php.cn. Applying these fixes, you can address this annoying issue effectively.

Windows 11 23H2 Is Released! How to Get It on Your PC?Windows 11 23H2 Is Released! How to Get It on Your PC?Apr 14, 2025 am 12:46 AM

Microsoft has released Windows 11 23H2 (the Windows 11 2023 Update) for a while. Do you want to install this update on your device? What are the new features in it? How to get this update immediately? Now, you can get the information from this php.cn

How to Bypass Windows Defender Windows 10/11? - MiniToolHow to Bypass Windows Defender Windows 10/11? - MiniToolApr 14, 2025 am 12:45 AM

Windows Defender can protect your computer and the files on the device from attacks or infection of malware and viruses. However, sometimes, you need to bypass Windows Defender due to some reason. In this post on php.cn Website, we will introduce 3 w

6 Best Ways for Data Supplied Is of Wrong Type on PC6 Best Ways for Data Supplied Is of Wrong Type on PCApr 14, 2025 am 12:44 AM

When trying to copying or transferring files from mobile phones to your computer, you might get the Data supplied is of wrong type error message. If you have no idea about how to address it, this post on php.cn Website can help you out.

Discover How to Reset Excel to Default Settings EffortlesslyDiscover How to Reset Excel to Default Settings EffortlesslyApr 14, 2025 am 12:43 AM

Want to revert changes you have made to Microsoft Excel? Here this article on php.cn Software aims to show you how to reset Excel to default settings in Windows 10 with the most effective ways.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment