Hack the password of a Linux virtual machine

Source: Internet
Author: User

Virtual machine hack Secret code step:

a virtual machine (server) login usually requires a local user, and the local user password if you do not know or have forgotten, there is a way to enter, in the Linux system can provide this access to the program, and the basic idea is to reset the administrator (root) login password , the following are the specific actions:
1, restart the virtual machine server, the GRUB boot menu when you press the E key to enter the editing state (in fact, you can restart the process of non-stop press the E entry to prevent the interface is not caught, the interface stays relatively short)

Restart the virtual machine on the restart above the point machine;

This interface is the grub interface, stay for a few seconds, in the presence of this interface when the E is not easy to catch, it is recommended to restart the interface before the appearance of press E, guaranteed to be able to enter the editing state;

This interface is the editing interface, you can press the upper and lower direction key to flip;


2, find linux16 line, add Rd.break console=tty0 at the end, press ctrl+x key into recovery mode

Locate the Linux16 line, and then press the end key to jump to the end of the position, enter " space ", enter the command rd.break console=tty0 , and then CTRL + X Enter recovery mode


3. Mount the root directory on the hard disk in a writable manner and reset the root password:

After entering recovery mode, enter the following command to re-mount the root system, switch to the root system, set the password specified in the exam, and mark the next start of the Redo SELinux label, and a series of operations.

switch_root:/# mount-o remount,rw/sysroot          // Re-mount the root system in a read-write manner
switch_root:/# chroot/sysroot/          &NBSP  //Switch to the root system
sh-4.2# passwd root      // Set the password specified for the exam     #sh -4.2# echo 123456 | passwd--stdin root    / /here or use this non-interactive way to set the password more concise   
sh-4.2# touch/.autorelabel       //mark next start Redo SELinux label
sh-4.2# exit
switch_root:/# reboot



4. Configure host name, IP address/mask/default gateway/DNS address
[Email protected] ~]# Hostnamectl set-hostname serverX.example.com
[Email protected] ~]# nmcli connection Modify "System eth0" Ipv4.method manual ipv4.addresses "172.25.x.11/24 172.25.x.25 4 "Ipv4.dns 172.25.254.254
[[email protected] ~]# nmcli connection Modify "System eth0" Connection.autoconnect Yes //Allow automatic connection when required
[[email protected] ~]# nmcli connection up "System eth0" //activating NIC configuration information

Hack the password of a Linux virtual machine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.