How to modify the Ubuntu root password and prevent others from modifying the password in single-user mode

Source: Internet
Author: User

How to modify the Ubuntu root password and prevent others from using the single-user mode to change the password after Linux is installed, there will be a Ubuntu root user. So how can I change the password of the Ubuntu root user without knowing the password? In this system, the RedHat Linux installation environment is vmware 6.0 guided by GRUB. AD: the Ubuntu root password must be used by Ubuntu users. I will briefly describe the Ubuntu root password because many others will not use it. the features of the Ubuntu root system can be used for learning Ubuntu root, a computer Major in colleges and universities, as an open-source enthusiast of Ubuntu root, or as a user of Ubuntu root. Part 1: how to crack the Ubuntu root password. After Linux is installed, a Ubuntu root user is created. So how can I change the password of the Ubuntu root user without knowing the password? In this system, the RedHat Linux installation environment is vmware 6.0 guided by GRUB. The method is as follows: 1. Press "e" on the grub boot interface to enter the grub editing mode. 2. Select the second option in edit mode, that is, "kernel/vmlinuz-2.4.20-8 ro root = LABEL = /". Then press "e" to edit this item. 3. Add "single" to the end (Note: There is a space in front ). Press enter and then press "B" to start the linux single-user mode. 4. Because it is in single-user mode, no password is required. After the boot is complete, at the prompt (note that the prompt is like sh-2.05b #, not the previous prompt) input: "passwd root" (passwd is the command to change the user password .). Then, modify the password as prompted. (Sometimes the system prompts bad password. It doesn't matter. The reason is that the password is too simple or a common word .) (Or, go to the password configuration file, vi/etc/passwd, and delete the password icon, that is, you need to delete the root: x: 0: 0 in the first line .... change to root: 0: 0... (delete X ). The password is successfully cracked .) 5. Restart and enter normally. OK. The Ubuntu root password has been modified. Part 2: prevent others from modifying their passwords in single-user mode. To guide the single-user mode, you must edit it in grub. Therefore, we only need to encrypt grub and prevent others from modifying grub. The method is as follows: 1. grub has a configuration file in the/etc folder. The name is "grub. conf". Locate the file and use vi to edit it. 2. let's take a look at the content in the file: (annotation is free) default = 0 timeout = 10 splashimage = (hd0, 0)/grub/splash.xpm.gz title Red Hat Linux (2.4.20-8) root (hd0, 0) kernel/vmlinuz-2.4.20-8 ro root = LABEL =/initrd/initrd-2.4.20-8.img specific meaning you can view the grub documentation, here we want to add a password. You can add a password in two places. 3. Add "password = 123456" (123456 is your password) under "timeout = 10 ). Save, exit, and restart. We can see that the grub interface cannot be modified by "e. To modify the password, press "p" to enter the password. 4. The second place is under "initrd/initrd-2.4.20-8.img. Add "password = 123456" here (123456 is your password ). Save, exit, and restart. We can see that there is another password before linux is started (after the grub interface. It is worth noting that this password can prevent entry in single-user mode. That is to say, even if we start the single-user mode by editing grub, we still need to enter this password. Part 3: how to crack the grub Password and obtain user permissions. To obtain the grub Password, we have to find a way to read the grub. conf file. But there is no grub Password, and there is no Ubuntu root password... Therefore, we cannot boot through grub. The method is as follows: 1. First, modify the VM startup mode. We need to start the VM from the CD. By default, virtual machines use the hard disk as the first boot mode. When the virtual machine is started (the big "vmware" Interface), immediately press "F2" to enter the bios. 2. Select the boot column. Select the CD-ROM Drive item and press + to upgrade the CD-ROM Drive to the top. In this way, the first boot mode is enabled by default. 3. Bind The first installation disk image of linux to the optical drive, save it, and restart it. The system directly enters the installation interface of linux. Enter "linux rescue" at the prompt and press Enter. The system will start the linux rescue mode. 4. There are several options on the way, just select as prompted. There is a prompt to select "Continue". Some people may prefer to use it as the "Skip" option during installation. Here, I will ask if you want to enter the security mode. Select yes. Finally, we will see a description, which means that the rescue system mounts the original system file (the one on the hard disk) to the "/mnt/sysimage" folder. (We Can cd/mnt/sysimage, and then vi/etc/grub. conf). 5. After starting, we can find the grub. conf file. Note the structure of the folder: we are now in the root directory of the rescue system. We are looking for the "/etc/grub. conf" of the original system, so the complete path is: "/mnt/sysimage/etc/grub. conf ". You can use vi to edit the file. Then, modify the file, delete the encrypted key, and save and exit. The password is successfully cracked. 6. Restart, set BIOS again, and start from hard disk. Part 4: How to prevent others from guiding to the linux rescue mode. We can see that the bios must be modified to boot to the rescue mode. Then, we can encrypt the bios to prevent others from modifying the bios and thus cannot boot from the disc. The method is as follows. After entering the bios, select "Security. Press enter on "Set Supervisor Password. Set the password. In this way. We need a password when restarting the system and entering the bios again. Part 5: how to crack the bios password. What methods do we usually use to clear the host bios password? Unplug the Jumper and swap the battery to restore the bios settings. Is there a similar method on a virtual machine? The method is as follows: Find the folder where the VM is located. There should be a file with the suffix ". nvram. Delete this file. Start the system. We can see that. The bios is reset. Part 6 and follow-up: prevent others from deleting files. This part already belongs to windows and will not be described. What I want to say here is that too much reliance on technology will only make the system more and more complex, and too many passwords have already placed a great burden on us. Moreover, there is no absolutely secure system, and the final solution still requires people to consciously abide by the rules.

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.