How to fix SSH connection issue with Ubuntu VM

Martin S 0 Reputation points
2024-01-30T10:31:11.47+00:00

Hi, Our VM instance has been stopped for a few months but we have recently restarted it but we are unable to connect using SSH. We ran the issue through the troubleshooter with the below result: User's image

How would we go about fixing this issue? Thanks!

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

1 answer

Sort by: Most helpful
  1. Deepanshu katara 14,895 Reputation points MVP
    2024-01-30T11:10:25.3666667+00:00

    Hi , Please run the below command for this VM inorder to allow port 22 for inbound connectivity use serial console to do this ufw allow 22/tcp It is also possible to open port by service name instead of the port number ufw allow ssh After that, you can check connecting to VM through public IP address via SSH using a putty or bash. If you continue to see the same issue, then check security rules
    Use IP flow verify to confirm if a rule in a network security group is blocking traffic to or from a virtual machine. You can also review effective security group rules to ensure inbound "Allow" NSG rule exists and is prioritized for SSH port (default 22). For more information, see Using effective security rules to troubleshoot VM traffic flow. Or you can else Use the Azure VM Serial Console to further troubleshoot your SSH connectivity. For detailed troubleshooting, you can refer to troubleshoot-ssh-connection (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.