how to rd.break and be a HACKER
(developed on CentOS 7)
method 1:
reboot
arrow keys at GRUB
e to edit GRUB kernel boot parameters
erase junk
add useful stuff:
rd.break rw
Ctrl+X # to continue booting
chroot /sysroot # to get yrself into an environment where yr tools look in the right dirs for themselves
passwd root # the real hackering
touch /.autorelabel # make SELinux not freak upon next boot
Ctrl+D twice # to exit the rd.break environment and continue booting
method 2:
e to edit GRUB
add useful stuff:
systemd.debug-shell=1
Ctrl+X # to continue booting
Ctrl+Alt+f9 # to switch to the debug-shell TTY. a root session will be there logged in
passwd root
systemctl stop debug-shell # undo the horrifically unsecure thing you just did to yr system
Ctrl+Alt+f1 # and login
method 3:
e to edit GRUB
add params:
rw rd.break enforcing=0
chroot /sysroot
passwd root
Ctrl+D twice # NO LOGOUT tho, careful!! continue booting ONLY
login
restorecon -Rv /etc # or possibly just /etc/shadow?
now safe to reboot
if no reboot, do:
setenforce=1 # to turn SELinux back on
half-method 4:
e to edit GRUB
add params:
init=/bin/bash
# can use similarly to rd.break and get into system all hackerly and cool
# but the environment is weird and rebooting is confusing
# you CAN use passwd and /.autorelabel like normal
# but is just weird.
# maybe test more later
notes:
if you don't use "rw" on the kernel boot param line, you have to remount /sysroot with rw after rdbreaking
ex.: mount -o remount,rw /sysroot
in GRUB, kernel boot params that come later take precedence over those that come first
thus you can add "rw rd.break" to the end of the long string of junk without having to worry about going back and erasing the part that says "ro"
other kernel boot parameters:
nomodeset
# good for video card trouble
# turn off Kernel Mode Setting (KMS) which is "a method for setting display resolution and depth in the kernel space rather than user space" -ArchLinux Wiki
quiet splash
# often used together
# hide boot messages to avoid alarming people
# show a pretty splash screen
rhgb
# Red Hat Graphical Boot
# like splash but RHEL-customized for RHEL-family OSes
to permanently edit kernel boot parameters:
note that, when you change with "e to edit GRUB", changes only last thru that individual boot
permanent edits go like:
vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT=""
then regen grub with:
grub-mkconfig -o /boot/grub/grub.cfg
(please note that this segment of instructions not yet tested by the author)
references:
https://wiki.archlinux.org/index.php/Kernel_parameters
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_monitoring_and_updating_the_kernel/configuring-kernel-command-line-parameters_managing-monitoring-and-updating-the-kernel
https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html
http://www.gnu.org/software/grub/manual/grub/html_node/Authentication-and-authorisation.html#Authentication-and-authorisation