Forgetting the root password and retrieving it under Linux

02-03-2024

Log in as root and execute:

#Passwd username (change password) # useradd username (add user)

Specific examples are as follows:

[root@bogon ~]# passwd rootchanging 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 in Linux

The root of Linux enjoys supreme power, and once the root password is forgotten or stolen, it can be a very headache. So how can we retrieve the root password? I summarize it as follows:

(1) Linux system password cracking

1. Press e in the grub options menu to enter editing mode

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

3. Press b to restart

4. Execute the following commands after entering

root@#passwd root (Configure the password for root)enter new unix password:Enter a new password
root@#init 6

(2) Debian Linux system password cracking

1. In the grub options menu 'Debian GNU/Linux' (recovery mode), press e to enter editing mode

2. Change the row of ro single in the kernel to rw single init=/bin/bash, and press b to restart

3. Execute the following commands after entering

root@(none)#mount -aroot@(none)#passwd rootroot@(none)#reboot

(3) Freebsd system password cracking

1. Start up and enter the boot menu

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

3. Enter a list of commands after entering

root@#mount -aroot@#fsck -yroot@#passwd(Change password command)


Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us