How to Reset Identity on RHEL 8 - nomorespice/rhel8-howto GitHub Wiki

This procedure will guide you through the identity reset process on a Red Hat Enterprise Linux 8 server.

This document assumes that:

  • you installed the RHEL 8 x64 Operating System according to How to install RHEL 8 via kickstart
  • you are performing these tasks as root
  • you are performing these tasks in order, as some tasks require others to be completed first

Reset the systems identity

Be sure to modify the following to customize for your environment:

  • Red Hat subscription USER
  • Red Hat subscription PASSWORD
subscription-manager clean
/usr/sbin/logrotate -f /etc/logrotate.conf
/bin/rm -f /var/log/*-???????? /var/log/*.gz
/bin/rm -f /var/log/dmesg.old
/bin/rm -rf /var/log/anaconda
/bin/cat /dev/null > /var/log/wtmp
/bin/cat /dev/null > /var/log/lastlog
/bin/rm -rf /tmp/*
/bin/rm -rf /var/tmp/*
/bin/rm -f /etc/ssh/*key*
/bin/rm -f ~root/.bash_history
unset HISTFILE
/bin/rm -rf ~root/.ssh/
/bin/rm -f ~root/anaconda-ks.cfg
/bin/rm /etc/machine-id
systemd-machine-id-setup
/bin/rm /etc/insights-client/machine-id
subscription-manager register --username=USER --password='PASSWORD'
subscription-manager subscribe --auto
insights-client --register
dnf -y clean all

Reboot the system

reboot