%post # User setup DEFAULT_USERNAME='rocky' DEFAULT_PASSWORD='rockylinux' DEFAULT_GROUPS='wheel' useradd --comment "Rocky Linux" \ --uid 1000 \ --create-home \ --user-group "${DEFAULT_USERNAME}" \ --groups "${DEFAULT_GROUPS}" echo -e "${DEFAULT_PASSWORD}\n${DEFAULT_PASSWORD}" | passwd "${DEFAULT_USERNAME}" passwd -e "${DEFAULT_USERNAME}" # Lock the root account passwd -l root # GRUB setup cat << EOF > /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="" GRUB_DISABLE_RECOVERY="true" GRUB_DISABLE_OS_PROBER="true" GRUB_ENABLE_BLSCFG="false" EOF chmod 644 /etc/default/grub # Rebuild the RPM database rpm --rebuilddb %end