Skip to content

Instantly share code, notes, and snippets.

@bgulla
Last active July 7, 2023 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgulla/36858dbb68533148d5333dd14de24f51 to your computer and use it in GitHub Desktop.
Save bgulla/36858dbb68533148d5333dd14de24f51 to your computer and use it in GitHub Desktop.
Proxmox script to fix WebVNC after an IP change
#!/bin/bash
## https://forum.proxmox.com/threads/console-failed-to-connect-to-server-host-key-verification-failed.78957/
# Usage: ./proxmox_webvnc_fix.sh <shorthostname>
# Notes: may need to run twice for the fix to take.
set -e
DOMAIN="lark.lol"
if [ $# -eq 0 ]; then
echo "No hostname provided. Exiting..."
exit 1
fi
HOST=${1}
IP=`host ${HOST} | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'`
echo " ${IP} belongs to ${HOST}"
ssh-keygen -f "/etc/ssh/ssh_known_hosts" -R "${HOST}"
# perform the fix
yes | /usr/bin/ssh -e none -o "HostKeyAlias=${HOST}" root@${IP} /bin/true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment