Home  >  Article  >  Operation and Maintenance  >  How to retrieve the root password if you forget it in Linux

How to retrieve the root password if you forget it in Linux

WBOY
WBOYforward
2023-05-12 08:13:055612browse

Log in as root and execute:

# passwd 用户名 (修改密码)
# useradd 用户名 (添加用户)

Specific examples are as follows:

[root@bogon ~]# passwd root
changing password for user root.
new unix password:
bad password: it is based on a dictionary word
retype new unix password:
passwd: all authentication tokens updated successfully.

Root password retrieval method under linux

root in linux Enjoy supreme power. Once the root password is forgotten or stolen, it is a very headache. So how can you retrieve the root password? I summarize it as follows:

(1) Linux system password Crack

1. Press e in the grub option menu to enter edit mode

2. Edit the kernel line /init 1 (or /single)

3. Press b to restart

4. After entering, execute the following command

root@#passwd root (配置root的密码)
enter new unix password:输入新的密码
root@#init 6

(2) Debian linux system password cracking

1. In the grub option menu 'debian gnu/linux,...(recovery mode)', press e to enter the editing mode

2. Edit the ro single in the kernel line and change it to rw single init=/bin/bash, press b to execute the restart

3. After entering Execute the following command

root@(none)#mount -a
root@(none)#passwd root
root@(none)#reboot

(3) freebsd system password cracking

1. Boot into the boot menu

2. Select each item (press 4) to enter single-user mode

3. Enter a series of commands after entering

root@#mount -a
root@#fsck -y
root@#passwd(修改密码命令)

What versions of Linux are there?

Linux versions include: Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and other versions. Among them, Deepin is one of the best-developed Linux distributions in China; Ubuntu Kylin is a derivative distribution based on Ubuntu; Manjaro is a Linux distribution based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP and is simple and easy to use; Ubuntu is a desktop application Mainly Linux operating system.

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

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete