I turned on UFW on my ubuntu linux vm in azure, and now I can't connect to it over ssh (or anything). On both the private and public IP.
Is there any way for me to connect to my vm now? eg the equivalent of like an iLo interface for physical machines?
Here is an msdn blog describing exactly this situation.
In a nutshell:
ufw_disable.sh
sh ufw_disable.sh
The script will be run as root, so there is no need to do sudo
inside the script (in fact this will cause things to fail).
ufw_disable.sh:
ufw disable
ufw status
You can add your new IP from the cloud shell.
az vm run-command invoke -g VMResourceGroup -n VM --command-id RunShellScript --scripts "ufw allow from 74.125.90.78 to anyport 22"
Change the ip address and the port to your own values.
Even simpler with the latest Azure...what a lifesaver:
Azure Portal > Your VM > Run command > RunShellScript
In the textbox for Linux Shell Script, type:
ufw disable
ufw status
Click Run button. Done.
Azure portal provides the easiest way to get into the serial console through its portal. Follow these steps
Azure Portal > Your VM > Support + Troubleshooting > Serial Console.
Now even if you firewall is blocking ssh, you can access this serial console and simply disable it using sudo ufw disable or add the 22 ssh port to the firewall
Method Provided by @Vince somehow did not work for me
even further simple solution
Setup your serial console Pic for serial console path
Run this on the machine as root:
ufw allow ssh
A more strict approach would be:
ufw limit ssh
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.