In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the solution to forgetting the root user password under Linux system". The explanation in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian and go deep into it slowly to study and learn "the solution to forgetting the root user password under Linux system" together!
GRUB: On the bootloader menu, type [e] to enter edit mode. You will be presented with a list of guided items. Find lines in which the output looks like:
kernel /vmlinuz-2.4.18-0.4 ro root=/dev/hda2
Press the arrow key until the line is highlighted, then press [e]. You can now tell GRUB to boot single-user Linux mode by adding a single space at the end of the text. Press the [Enter] key to make the edit take effect.
You will be taken to the Edit Mode screen, from here, press GRUB to boot single-user Linux mode. When you finish loading, you will be presented with a shell prompt similar to the following:
sh-2.05#
Now you can change the root command by typing:
bash# passwd root
You'll be asked to retype the password to verify it. When finished, the password will be changed and you can reboot by typing reboot at the prompt; then log in as root as usual.
When the System Selection screen appears, press the "e" key on Options for Red Hat Linux,
Then three options will appear, press the "e" key on "kernel/boot/vmlinuz-2.4.18-14 ro root=LABEL=/" to edit,
Add "single" before "ro" or "root" and return.
press "b" key to start, enter character interface, when appear "sh-2.05b #," it means that has entered single user mode.
Now, type "passwd root" and you can reset the root password.
After the setup is complete, reboot and restart, you can enter the linux system with the password you just set.
I. lilo
1. Type linux single at the lilo: prompt
Lilo: Linux Single
2. Enter to go directly to the linux command line
3. #vi /etc/shadow
Delete the first line, after root: and before the next: ,
The first line would look like
root::......
save
4. #reboot, root password is empty
II. grub
1. When the grub screen appears, use the up and down keys to select the item you usually start linux (do not select dos yo), and then press the e key
2. Use the up and down keys again to select the item you normally boot linux in (similar to kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/), then press e
3. Change the command line you see now and add single, and the result is as follows:
kernel /boot/vmlinuz-2.4.18-14 single ro root=LABEL=/
4. Enter to return, and then press the b key to start, you can directly enter the linux command line
5. #vi /etc/shadow
Delete the first line, after root: and before the next: ,
The first line would look like
root::......
save
6. #reboot, root password is empty
For Redhat Linux:
Place the cursor on the linux system with the up and down keys and press "e"
Press "e" on the kernel line, type "space single" and enter
Press "b" to start, the system will automatically enter single user mode,
Using the passwd root command, follow the prompts to enter the new password
After modifying the password, enter the reboot command to restart the system
III.
1) Restart the system. When the system starts to the grub or lilo(now generally grub) boot menu, find the current boot item of the system (you can press the arrow key to expand the hidden menu);
2. Position the cursor on the option and press the letter "e" key to enter the editing state of the guide;
3. This option has three lines of statements. Please select the second line with the cursor, that is, the line at the beginning of "Kernel";
4. Press the letter "e" key in this line to enter the editing state of this line;
5. Add a space at the end of the line and write the number 1, similar to this:
kernel /boot/vmlinuz-2.6.9-11.19 ro root=LABEL=/ 1
6. After modification, press the "Enter" key to return to the original interface;
7. Press the letter "b" key to start the boot.
IV.
1). grub
1. When the grub screen appears, use the up and down keys to select the item you usually start linux (do not select dos yo), and then press the e key
2. Use the up and down keys again to select the item you normally boot linux in (similar to kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/), then press e
3. Modify the command line you see now and add single, resulting in the following: kernel /boot/vmlinuz-2.4.18-14 single ro root=LABEL=/
4. Enter to return, and then press the b key to start, you can directly enter the linux command line
5. #vi /etc/shadow Delete the first line, after root: and before the next: in the line that starts with root, the first line will look like root::... save
6. #reboot, root password is empty
2). When the system enters single-user state, directly use passwd root to change
5. Use the installation CD to boot the system, carry out the Linux rescue state, and hook up the original/partition. The method is as follows:
cd /mnt
mkdir hd
mount -t auto /dev/hdaX(partition number of original/partition) hd
cd hd
chroot ./
passwd root
That'll do it.
But this method also illustrates the vulnerability of linux single-user mode, which can be dangerous if someone intentionally changes the root password. Therefore, we also want to prohibit single user logins
In single-user mode, you can solve the Linux root password forgetting problem, which may also be used by friends with ulterior motives to crack the root user password and modify it, so it is not safe. Hehe, then we will prohibit single user login, please see the method below:
If you are using a single user securely, you need to configure GRUB password first by modifying either/boot/grub/grub.conf or/etc/grub.conf (/etc/grub.conf is a symbolic link to/boot/grub/grub.conf).
For example:vi /boot/grub/grub.conf Go to the configuration file editor. In splashimage this parameter can be added to the next line password= password, save after restarting the computer, login to the GRUB menu page again will find, then can not directly use the e command to edit the boot label, you must first use the p command, enter the correct password to be able to edit the boot label, but we set the plaintext password is not very safe.
(1) Linux system password cracking
1. In the grub options menu press E to enter edit mode
2. Edit kernel line/init 1 (or/single)
3. Press B to restart
4. After entering, execute the following command root@#passwd root (set root password)Enter new unix password: Enter new password root@#init 6
Debian Linux system password cracking
1. In the grub options menu 'Debian GNU/Linux,... (recovery mode)', press e to enter edit mode
2. Edit the ro single at the end of the kernel line to rw single init=/bin/bash, press b to restart
3. Run the following command root@(none)#mount -aroot@(none)#passwd rootroot@(none)#reboot
(3) Freebsd system password cracking
1. Boot to boot menu
2. Select each item (press 4) to enter single user mode
3. Enter the command root@#mount -aroot@#fsck -yroot@#passwd Enter new unix password:root@#init 6
(4) Solaris system password cracking
1. Do you wish to have it mounted read-write on /a ? [y,n,?] Select y3. Enter single user mode 4. Enter #passwd#New passwd: Enter a new password #Re-enter New passwd: Enter a new password #init 6 (Restart)
(V) NetBsd system password cracking
1. Boot: When the prompt appears and the countdown starts five seconds, type the following command: > boot -s (enter single user mode command)2. Enter pathname of shell or RETURN for sh: Press Enter at the prompt below. 3. Type the following command: # mount -a # fsck -y4. Change root's password using passwd. 5. Use the exit command to enter multiplayer mode.
Linux operating system password cracking complete
(1) Linux system password cracking 1. Press E in the grub options 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 (set root password)Enter new unix password: Enter new password root@#init 6
Debian Linux system password cracking 1. In the grub options menu 'Debian GNU/Linux,... (recovery mode)', press e to enter edit mode 2. Change ro single at the end of the line to rw single init=/bin/bash, press b to restart 3. After entering, execute the following command root@(none)#mount -aroot@(none)#passwd rootroot@(none)#reboot
(3) Freebsd system password cracking 1. Boot to boot menu 2. Select each item (press 4) to enter single user mode 3. Enter a series of commands root@#mount -aroot@#fsck -yroot@#passwd(password modification command)root@#root(user name to crack password)Enter new unix password:root@#init 6 (restart)
Do you wish to have it mounted read-write on /a ? [y,n,?] Select y3. Enter single user mode 4. Enter #passwd#New passwd: Enter a new password #Re-enter New passwd: Enter a new password #init 6 (Restart)
(5) NetBsd system password cracking 1. Boot: When the prompt symbol appears and the countdown starts five seconds, type the following command: > boot -s (enter single user mode command)2. Enter pathname of shell or RETURN for sh in the following prompt symbol: Press Enter. 3. Type the following command: # mount -a# fsck -y4. Change root's password using passwd. 5. Use the exit command to enter multiplayer mode.
The last step of typing "EXIT" enter, the computer will automatically restart, here to crack the root user password.
If someone else gets the plaintext password, they can still modify the GRUB boot label to change the root password.
MD5 is used to encrypt it. Enter grub-md5-crypt in the terminal, and the system will ask for the same password twice, after which the system will output MD5 code. You just need to copy the generated MD5 ciphertext, then set the global or menu password according to the password --md5 MD5 ciphertext format, save and exit, and restart the computer.
In this way, you can start linux single-user mode, a bit similar to windows security mode, that is, only start the most basic system, network services, system services, etc. are not started. After the single-user mode boot is complete, there will be a #prompt indicating that you have super user privileges, and then execute the command after #:
/usr/bin/passwd
The system should prompt you to enter the password. This password is not echoed. Just make sure you enter it correctly. After entering, the system will ask you to enter it again. The input requirements are consistent, and then you will see a prompt that the password has been modified successfully. Then type the command init 3. Type in the character interface mode of the system (the system will change the running level again), see the login: prompt, and try again whether you can log in with root and the password you just modified.
Thank you for reading, the above is the "Linux system forget root password solution" content, after the study of this article, I believe we forget the root password solution under Linux system this problem has a deeper understanding, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.