booting the system into emergency mode with SELinux disabled

maelamrani

Member
Joined
Jan 3, 2020
Messages
77
Reaction score
7
Credits
450
Hello,

I have a question :

--Reset root User Password As root on server
reset the root user password by booting the system into emergency mode with SELinux disabled. Try to log in with root and enter the new password after the reboot.

Should i disable it and the reboot and boot with emergency mode or i can boot with emergency mode and disable it

Can you show me how i can do : boot with emergency mode and disable it

Kind regards,
 


G'day @maelamrani ;)

If the answers you are seeking are distro-specific you should always state which one you are using, including in the Title.

Do I take it from the reference to SELinux that you are still using Redhat 8?

I don't have the answer to your question but I can move this to Redhat and Derivatives if you wish.

Cheers

Chris Turner
wizardfromoz
 
You can keep selinux on enforcing when wanting to reset the root password from emergency mode:
1. Boot into : Emergency mode and chroot into the system.
2. Reset: Reset root password
3. Create a file: touch /.autorelabel
4. exit: exit out until the system starts to reboot.
 
The purpose is Using Kernel boot parameters to disable SELinux
Because i have an error when i change it

But Hen i use rd.break
chroot /sysroot
mount -o remount,rw /
passwd : change password
touch .autorelabel
reboot
it works

i need to use emzrgency
 
I don't understand your question seems like you are saying two things at once: It works and it doesn't work. Rephrase your question so that it is more clear as in what your problem is, also give the errors if you are getting any errors, because that is the way to reset your root password from emergency mode.
 
Its work when i add rd.break ctrl x in end of line that begin with linux

But if i add emergency i need to introduce the root password then i need to change it but it doesn't work i will past the error
 
Its work when i add rd.break ctrl x in end of line that begin with linux

But if i add emergency i need to introduce the root password then i need to change it but it doesn't work i will past the error
What error do you get when changing the root password from emergency mode. Try doing(instead of just /): mount -o remount,rw /sysroot
 
Last edited:
I fount it :
i added : kernel /vmlinuz-2.6.32-279.el6.x86_64 root=/dev/md3 selinux=0 .... rhgb quiet emergency
ctrl+x => actual root password


then
mount -o remount,rw /
then passwd

if i dont user mount -o remount,rw /
i get the "passwd authentication token manipulation error"
thx guys
 
This is the way to reset your root password when have lost your root password. Since you have no way of typing in the root password if you have forgotten it.
1. add rd.break too kernel boot options
2. mount -o remount,rw /sysroot
3. chroot /sysroot
4. passwd root
5. touch /.autorelabel
6. exit out until the system reboots.

There are two ways of getting into emergency mode:
1. Adding emergency to the kernel boot parameters. This makes the system boot normally and mounts the root filesystem read only. So when you do a passwd, the system can't adjust the password in /etc/shadow because that file is also read only. So after you do mount -o remount,rw / the root filesystem becomes writable, so then it allows you to reset your root password.
2. Adding rd.break to the kernel boot parameters, this stops the regular boot up process before the root filesystem is mounted. After you which you have to manually mount the sysroot and chroot sysroot in order to get into your system.
 
I say if someone using redhat, let him/her pay for the help!
Just my opinion, but whay add stress for free?
 
Last edited by a moderator:
I have a question where can i find the dump exam for rhcsa ?
There are no example exams for RHCSA since they are practical exams.
 
I know i wanna just know the last pratical exam
Since they are practical exams there are no recent exams of them available on the internet.
 

Members online


Top