• 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

Password prompt in single user mode is not secure : CentOS/Red Hat

January 8, 2014 by Sharad Chhetri Leave a Comment

In this post I will discuss about, how a person still can log into Single User mode even if you have secure the single user mode.We can still login into system even if you are getting password prompt in single user mode / runlevel 1.The practical has been done in CentOS 6.x and Red Hat 6.x.
In some articles you may have read about securing root access in single user mode.In which System Admin do editing in /etc/sysconfig/init file and write SINGLE=/sbin/sulogin whereas it disable sushell by giving comment on the line #SINGLE=/sbin/sushell .After this when we restart the system,we also see in Single User Mode it is asking Root password and believe that Single User mode is safe.( See the given below screenshot)

runlevel 1

NOTE: Red Hat do not recommend this. As per Red Hat recommendation we can secure root access by putting grub password.

Follow the steps to know,how you can still access in single usermode with root password even SINGLE=/sbin/sulogin has been implemented.

Requirement: No CD/DVD/USB or extra media required
Condition: GRUB password should not be set

Step 1: Restart the system and go to single user mode or runlevel.Read my previous post about how to reset root password in runlevel 1 .
Follow our previous post and reach up to Step 4

See below screen shot,when system reach to this screen.With the arrow key,select the line starting with kernel /vmlinuz-.Now press “e” from your keyboard to edit.

runlevel1

Step 2: Now we will add the command in line as given below after typing press ENTER.See the screenshot (only type given below command after giving a space)

init=/bin/bash

runlevel 1 root passwd

Step 3: After pressing ENTER key,you will be back to previous screen. Now press the key “b” to boot the system

System will be booted and directly login with user root in runlevel 1,without giving any password. But the system will not allow you to edit any file because it is in read only mode.

Now terminal now run the command


mount -o remount,rw /

See the below given screenshot for reference

runlevel 1 root password

Step 4: Now reset the root password and give new password

passwd root

Step 5: This step is optional. If you want to remove the Password prompt in runlevel 1/Single User mode. Edit 2 lines in the /etc/sysconfig/init file as given below.

vi /etc/sysconfig/init

Locate the line having parameter as SINGLE=/sbin/sulogin. Comment this line like this #SINGLE=/sbin/sulogin . (to comment use # sign in starting of the line, see given below screenshot)

And uncomment the line, SINGLE=/sbin/sushell (Remove # sign in starting of the line,to uncomment )

runlevel 1 root password

Save and exit the file. (In vi editor for save and exit, use keys, ESC : wq! and hit enter)

Step 6: Now reboot the system by using Magic Sysreq. If you are trying to reboot the system by init,shutdown or reboot command.The system will not reboot,it will show error or might be hanged)

echo b > /proc/sysrq-trigger

The system will be rebooted.

Step 7: Now check the new root password in runlevel 1. If you have followed Step 5 then also check the password prompt in Runlevel 1.Because we edited the /etc/sysconfig/init file,it will not ask for password prompt in runlevel 1

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. Installing rails in verbose mode CentOS and Red Hat
  3. bash scripting : Prompt user yes / no for confirmation
  4. Set GRUB password after installation of CentOS/Red Hat
  5. lock user login after failed login attempts in Red Hat 6.x and CentOS 6.x
  6. create and delete user in Red Hat and CentOS
  7. Install Ubuntu font family for individual user in CentOS/Red Hat
  8. Linux: Set user password by using encrypted password in command
  9. How to add/install Ubuntu fonts in CentOS/Red Hat Linux
  10. How to install and configure Secure FTP server in Ubuntu 12.04 LTS

Filed Under: Linux, Tips And Tricks Tagged With: forgot root password, runlevel, single user mode

Reader Interactions

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

How to download package using apt-get command in ubuntu

set and unset line number in file with vi editor

Set GRUB password after installation of CentOS/Red Hat

How to see line numbers in file through cat command

How to hide php version information in header

Show visitor ip address php code

rsync all files,hidden files,symlinks,hardlinks to remotes Linux Server

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