Skip to content

Instantly share code, notes, and snippets.

@bebrooke
Created February 4, 2024 00:13
Show Gist options
  • Save bebrooke/b4f1c74746d9ed553003471c57809e05 to your computer and use it in GitHub Desktop.
Save bebrooke/b4f1c74746d9ed553003471c57809e05 to your computer and use it in GitHub Desktop.
hyper-v hvc
# https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/
# https://patrickwu.space/2019/02/16/hyper-v-hvc-command/
# Below working on Win 11 Pro 23H2 22631
# Doesn't seem to like win32-openssh location (spaces in program files). Set the following env variable (System)
HV_SSH_COMMAND C:\Windows\System32\OpenSSH\ssh.exe
# No gui setting to add com port in gen 2 vm. Use the cmdlet when VM powered off
Set-VMComPort -VMName TestVM -Number 1 \\.\pipe\testvmpipe
# For Linux VM Serial Console
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200n8"
update-grub2 (Debian)
systemctl enable serial-getty@ttyS0.service
# HVC Commands
hvc ssh -F none user@VMName # SSH ignoring .ssh/config
hvc serial -c VMName # connect on VM serial console, enabling console output (without this everything is printed to the console)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment