Skip to main content

How To Reset root pass in RHEL 7 & CentOS 7

   
    Hi every one in this post i will show you, how to reset  forgot root password in RHEL_7 & CentOS_7 . Short record of the prosses i will post later.
    In previous post i used "init=/bin/sh" for resetting but now i will show another way of resetting root pass. Let's begin
     First in grub loader menu tab  'e'  enter edit boot options from here go to line beginig with 'linux16' in this line delete words 'rhgb', 'quite' and add 
'rd.break' press 'Ctrl+x'  and we boot in emergency mode where system mount to "sysroot" . Enter below commands:
  1. mount -o remount,rw /sysroot       #remount as read write /sysroot
  2. chroot /sysroot      #change root folder to sysroot
  3. passwd   #for resetting root password
  4. touch /.autorelabel         #for selinux  
  5. exit    #twice enter exit
    After above steps, you will success reset root password. 

Comments

Popular posts from this blog

Salt -- cheat sheet

      The Salt system is a Python-based open-source remote execution framework for configuration management, automation, provisioning and orchestration.  A basic Salt implementation consists of a Salt master managing one or more Salt minions.

Cheat Sheet

Bash: echo $? - exit status of last command (0 no error) ' - Single quote removes meaning special meaning of special character. find /qwe -type f -iname *.js -exec cp --parents -t /tmp/ {} + -- find all js files and copy with parent directory ystemctl set-default graphical.target (ls -l /lib/systemd/system/runlevel*) -- set runlevel echo <password> | sudo -S for i in t@01 st@02 ba@sta03;do ssh -o RequestTTY=true $i "sudo -l";done -- allow tty present VIM: :r! sed -n '16,812 p' < input_file.txt -- copy line range from input_file :1,10d -- delete line from 1 to 10 :se nu -- show line numbers Apache: Redirection in Apache (By default, the Redirect directive establishes a 302, or temporary, redirect.): URL:https://www.digitalocean.com/community/tutorials/how-to-create-temporary-and-permanent-redirects-with-apache-and-nginx <VirtualHost *:80> ServerName www.domain1.com Redirect 301 /oldlocation http://www.domain2.com/newlocation </VirtualHo