Somehow I managed to mess up a RHEL 6 Alpha machine’s SELinux configuration so seriously that I could no longer log in:
$ ssh email@example.com firstname.lastname@example.org's password: Unable to get valid context for root Last login: Wed Jan 6 18:34:46 2010 Connection to 192.168.122.242 closed.
However this is easy to fix with guestfish. Important: before you do this, make sure the guest is shut off.
# guestfish -i RHEL6Alpha Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Type: 'help' for help with commands 'quit' to quit the shell ><fs> ls / .autofsck bin boot dev etc home lib lib64 lost+found media mnt opt proc root sbin selinux srv sys tmp usr var ><fs> touch /.autorelabel ><fs> sync ><fs> exit
It’ll fix the SELinux labels for you when it boots. Lo and behold I can log in again.