Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Connect to arbitrary ssh port number with virt-manager

So I was away from my virtualization environment but I wanted to connect to it tunneled through ssh! I jumped through my bastion server and forwarded a port to the virtualization host.

ssh -L 5022:vm3.ipa.example.com:22 home

Where home is just an alias in ~/.ssh/config:

Match host home
   Hostname www.ipa.example.com
   Port 6022
   User bgstack15

And virt-manager doesn't have a way to let you configure port number in a custom connection string, but you can do it from the command line:

virt-manager -c 'qemu+ssh://myuser@localhost:5022/system?keyfile=id_rsa'

Upon first connection you have to accept the new/unknown ssh host key so you probably need package ssh-askpass-gnome.

References

Weblinks

  1. Ripped directly from https://fabianlee.org/2019/02/16/kvm-virt-manager-to-connect-to-a-remote-console-using-qemussh/

Search expressions

  1. libvirt qemu+ssh custom port

Comments