Step-by-step Guide:
- Download a linux live CD, e.g. Debian
- Make sure your VM prefers to boot from its virtual
Optical
drive: - Insert the downloaded image into the drive:
- (Re)Start the VM to boot into the live system.
- Start a terminal.
- Mount the VM's virtual hard drive:
$ sudo su
# mkdir -p /mnt/drive
# mount /dev/sda /mnt/drive
- Finally, correct the errors inside the VM:
# nano /mnt/drive/home/<USER>/.ssh/config
# nano /mnt/drive/etc/ssh/ssh_config
# nano /mnt/drive/etc/ssh/sshd_config
To prevent this to happen again, always keep one ssh connection open, until you have verified that the new configuration works. You can verify by restarting the sshd
service and establishing a second session in parallel (restarting the sshd
daemon does not terminate an established ssh session)!
Alternative approach: You could also try to mount the disk image into the hypervisor'shost's file system. However, the necessary steps for this approach depend on the hypervisor'shost's OS and the file type of the disk image (.vdi, .vhd, .vmdk, ...).