If you are locked out or messed up a linux machine, and you have physical access to the server, you can reboot to root console.
However, you will find everything mounted read only. So you can not do any changes.
To overcome this:
mount -o rw, remount /
This helped me out once.