There are significant differences between centos7 and centos6 in the steps of setting the grub password. This is recorded for future reference. The purpose of grub encryption: to prevent criminals from modifying the root password in single-user mode You can use plain text or encrypted ciphertext to encrypt grub. It is recommended to use the encrypted ciphertext method. The operation steps of the two methods are similar. This article takes the encrypted ciphertext method as an example. 1. Set up grub encryption 1. Use the grub2-mkpasswd-pbkdf2 command to create a ciphertext (be sure to save and remember the password you set) 2. At the end of the /etc/grub.d/00_header file, add the following content (root is the user name used for single-user login, and the third line after root is the ciphertext obtained after encryption in the previous step. Note that there is a space between root and the ciphertext, not a line break) cat <<EOF set superusers='root' password_pbkdf2 root grub.pbkdf2.sha512.10000.B157F42E96462AB239C03000F113D32EB18FD48073F1FC7D8F87A8F3B3F89F662424ECCAB901F3A812A997E547FD520F3E99D0E080F4FE8B05E019757E34F75B.29C83F87B4B6C086FC9A81E046CC3623CC5CF2F82128EDC3A0364894E429D4993B28563F82D71BF346188108CBD4341FC4A71B90E543581646B4E7EAE920C54A E0F 3. Recompile and generate grub.cfg file grub2-mkconfig -o /boot/grub2/grub.cfg The setup is complete. 2. Restart and use single user login test 1. Reboot to enter gurb interface 2. Press e 3. At this time, we need to enter the username and password we set to enter grub (seeing this interface means that we have set grub encryption to take effect). After entering correctly, you will enter the following interface 4. Edit and modify two places: change ro to rw, and add init=/bin/sh at the end of the line 5.ctrl+x starts single-user mode and enters the system 6. Change the root password 7. If selinux is turned on, you need to execute the following command to update the system information, otherwise the password will not take effect after restarting touch /.autorelabel 8. Restart the system exec /sbin/init Login successfully using the modified root password. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: js to achieve simple magnifying glass effects
>>: Python MySQL database table modification and query
Table of contents JSX environment construction Se...
You might be wondering why you should use the pat...
HTML forms are commonly used to collect user info...
"We're writing our next set of mobile pr...
Effect picture (if you want a triangle, please cl...
In HTML, common URLs are represented in a variety ...
Step 1: Ensure that MySQL has binlog enabled show...
motivation Due to learning needs, I purchased a v...
Table of contents Preface SQL statement optimizat...
This article is welcome to be shared and aggregat...
The meaning of key_len In MySQL, you can use expl...
Table of contents What is a mind map? How to draw...
Docker is really cool, especially because it'...
DIV+css structure Are you learning CSS layout? Sti...
1. flex-direction: (direction of element arrangem...