• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Set GRUB password after installation of CentOS/Red Hat

January 4, 2014 by Sharad Chhetri 1 Comment

In this tutorial we will learn about how to set GRUB password after installation in Red Hat based Operating System. In our last post,we have described about how to reset root password in single user mode. If our system does not have grub password set, anyone can reset root password after booting the system in single user mode. We can protect this by setting GRUB password.
The GRUB password can be set during installation and also after installation.

To set grub password after installation,follow the given below steps

Step 1: Login as a root in system

Step 2: Run the below given command to generate MD5 encrypted password for grub.

grub-md5-crypt

Once you give your new password and reconfirm.It will generate MD5 encrypted password. copy the Encrypted Password and save in a file in your Desktop.

grub

Step 3: Now we are editing the grub.conf file.Hence take the backup first.
Note: grub.conf file you can also edit with this path also i.e /etc/grub.conf

cp -p /boot/grub/grub.conf /boot/grub/grub.conf.orig

Now Edit the file and paste the given below line in grub.conf file
Now edit the grub.conf file.We use vi/vim editor . (Use your favorite file editor )

Replace $1$uR/cW1$OsEpHmVYyb8jwlszs53gh1 with your output which we have genrated after using command grub-md5-crypt

vi /boot/grub/grub.conf.orig

password --md5 $1$uR/cW1$OsEpHmVYyb8jwlszs53gh1

grub password

Step 4 After saving the file,now restart the system

init 6

Step 5: Now we will check the grub password has been working properly or not.
At first screen when we see the countdown time showing to boot the Operating system, press key ESC from your keyboard (Just as we did in our post,Reset root password in single user mode)

After pressing ESC key you will see screen as given below

set grub password

In bottom of screen you can read in second line, ‘p’ to enter a password to unlock the next set of feature . This confirms that grub password has been set.

Now to reconfirm your password press P key from your keyboard.And give grub password which you have set in Step 2 .Do not skip this part because if there is any typo mistake in editing grub.conf , next time in critical situation the password will not be accepted by grub security. Then you have to remove the grub password from system(We will discuss about the critical scenario in our upcoming post)

grub

After accepting correct password by grub security,you will be moved to next screen.Now from here you can do editing and also boot the system in any Runlevel(including Runlevel 1 aka Single User Mode)

grub

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Recover Linux Grub Password in linux rescue mode CentOS/Red Hat
  2. Password prompt in single user mode is not secure : CentOS/Red Hat
  3. How to add/install Ubuntu fonts in CentOS/Red Hat Linux
  4. Root Is Not Able To Login In Red Hat And CentOS
  5. lock user login after failed login attempts in Red Hat 6.x and CentOS 6.x
  6. Installing rails in verbose mode CentOS and Red Hat
  7. create and delete user in Red Hat and CentOS
  8. Setup Master Slave Chroot BIND DNS in CentOS 6 or Red Hat 6
  9. How to install apache webserver in CentOS and Red Hat
  10. How to create multiple mysql instance in CentOS 6.4 and Red Hat 6.4

Filed Under: Linux, Tips And Tricks Tagged With: grub, grub password

Reader Interactions

Comments

  1. Mika says

    November 28, 2015 at 11:35 pm

    CENTOS 7
    grub2-mkpasswd-pbkdf2

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

convert space into new line using sed command

Non interactive ,without typing password do ssh to Server : By sshpass

How to find swap partition or file in linux

Install libjpegtran by using yum command in CentOS 6.x

Could not find make anywhere!!! Please edit the config section to include the path to make. at ./install.pl line 2101

Virtual Machine inaccessible status on VirtualBox 4.3

How to install korn shell ksh in Linux

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy