Guestfish is a powerful tool that allows us to manipulate disk images directly without starting the VM. Here is how to configure SSH Root login:
guestfish --rw -a CentOS-7.qcow2 > run > mount /dev/sda1 / > vi /etc/cloud/cloud.cfg
In cloud.cfg, modify the following lines: disable_root: 0 and ssh_pwauth: 1. This method is highly efficient for pre-configuring cloud images.