How to use `virsh` via SSH without running `virsh` on the remote host?
Aug 10, 7:45pm
To use virsh via SSH without executing it on the remote host, you need to tunnel the libvirt socket over SSH. This allows your local virsh to communicate with the remote libvirt daemon (libvirtd) as if it were running locally.
Here’s how to do it:
Method: SSH Port Forwarding for Libvirt Socket
Libvirt uses a Unix domain socket (typically /var/run/libvirt/libvirt-sock) for communication. Since Unix sockets cannot be directly forwarded over SSH, you can use socat to expose the socket as a TCP port on the remote host, then forward that port over SSH.