You can download disk 1 of CentOS from
www.centos.org.
Let the machine boot from the disk.
Type linux rescue to boot the machine in rescue mode.
Choose the option to allow access to the hard drive
If you had made a copy of your original configuration file, you can use it to replace the one that is causing the problem.
If you didn't make a copy, you can backup the existing file and then edit it.
You should be able to do something similar with a live cd from Ubuntu.
The ability to boot from cd's is the main reason why security documents always recommend limiting physical access to your servers. It really doesn't matter which operating system you use.
It is very important to copy configuration files to a safe place before editing or replacing them.