Home  >  Article  >  Operation and Maintenance  >  How to reset Linux password if you forget it

How to reset Linux password if you forget it

藏色散人
藏色散人Original
2020-11-06 11:10:1832388browse

How to reset the Linux password if you forget it: first hit "e" on the kernel; then change the content on the linux16 line to "rw rd.break"; then enter the system's emergency rescue mode. And enter passwd and other commands in sequence; finally restart the service.

How to reset Linux password if you forget it

# Recommended: "

linux tutorial

People who are new to Linux may be at a loss if they forget the root password. I want to retrieve my root password, but I don’t know how. In fact, you only need a few simple steps to reset your root password (I don’t know how to retrieve it)

1. After booting, type

e on the kernel, and then edit Option

How to reset Linux password if you forget it

#2. In the linux16 line, change the content in the red box to

rw rd.break

How to reset Linux password if you forget it

How to reset Linux password if you forget it

According to the prompts, use the key combination

CTRL X to enter the password modification

3. Enter the emergency rescue mode of the system

How to reset Linux password if you forget it

4. Enter the following commands in sequence

# chroot /sysroot //进入系统的根目录
# passwd     //重置密码
# touch /.autorelabel  //创建文件,让系统重新启动时能够识别修改
# exit   退出chroot模式
# reboot //重启系统

How to reset Linux password if you forget it##5. Restarting is a bit slow, you need to wait patiently for a while, and you can use it after restarting Log in with the password you just reset

6. Change the password

If you haven’t forgotten your password, change it:

# passwd //之后会提示输入新密码 输入之后修改成功!

Change the password of a general user as root:

# passwd username(要更改密码的用户名)

<br/>

The above is the detailed content of How to reset Linux password if you forget it. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn