Cannot SSH through Putty to Azure Ubuntu 18 LTS VM server

SaidAlisic 21 Reputation points

Dear Microsoft Support team,

Yesterday I created an Ubuntu 18 LTS VM server through Azure which I successfully connected to through an SSH connection with Putty on my Windows 10 laptop and I only used "sudo apt-get update" to check if everything was working normally in the terminal, thereafter I disconnected from the VM by typing the usual "exit" command and my connection was closed. However, today (less than 24 hours later) I don't seem to be able to connect through Putty at all on the same VM, same port, same username, same ppk, and same IP address at all as I get a "Connection timed out" error whenever I try to connect. Could this be a problem with either the VM or my computer? However, I did not install anything on my computer since yesterday and it was on "Sleep Mode" from the time I finished my work after exiting the VM and until now when I powered it up again.

Said Alisic

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
6,807 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sumarigo-MSFT 42,516 Reputation points Microsoft Employee

    @SaidAlisic This article helps you find and correct the problems that occur due to Secure Shell (SSH) errors, SSH connection failures, or SSH is refused when you try to connect to a virtual machine (VM):

    There is also similar discussion thread here, please refer to the suggestion and let us know the status

    • Also check if Port 22 is Enabled/Allow on "default-allow-ssh" under "Inbound Port Rules". (Path: Dashboard > Select your VM > Networking (under Settings section)
    • Go to Serial Console type in your ssh username and you will be logged into the server

    Check the firewall status to see if port 22 is allowed

    sudo ufw status verbose

    If the rule is not there then add it

    sudo ufw allow ssh

    Azure VM and ssh connection: test succeeded but PuTTY timed out

    Also, to isolate the issue further you may take a look into the detailed troubleshooting steps outlined in the documentation Detailed SSH troubleshooting steps for issues connecting to a VM in Azure, and let us know how it goes.

    Hope this helps!
    Kindly let us know if the above helps or you need further assistance on this issue.


    Please don’t forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.