You need to use CentOS cd only to boot into emergency mode. You can access / in a single user mode. To fix this problem at Grub boot screen:
- Select the kernel
- Press the e key to edit the entry
- Select second line (the line starting with the word kernel)
- Press the e key to edit kernel entry so that you can append single user mode
- Append the letter S (or word Single) to the end of the (kernel) line
- Press ENTER key
- Now press the b key to boot the Linux kernel into single user mode
You need to mount at least / and other partitions:
Code:
mount -t proc proc /proc
mount -o remount,rw /
Now edit file /etc/ssh/sshd_config and allow root user. If you forgotten root password, just set new password, enter:
We have plenty of docs about grub and booting into a single user mode:
Linux: Grub Boot into single user mode
Linux reset forgotten root password
How to: Recovering Linux grub boot loader password