I cannot SSH into my Ubuntu VM from another computer

Mbongeni Maiketso 5 Reputation points
2023-06-06T18:17:38.7966667+00:00

I cannot SSH into my Ubuntu VM from another computer, Port 22 is open from the internet. I was able to do it, after restarting the VM I cannot connect anymore. I have also followed the trouble the shooting guide with no success. From my local machine, when I try to connect into my ubuntu VM on azure, I get a connection timed out error.

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

4 answers

Sort by: Most helpful
  1. Jackson Martins 10,556 Reputation points MVP
    2023-06-06T18:36:48.9633333+00:00

    Hi @Mbongeni Maiketso

    Have you reached all the NSG rules? follow the troubleshooting on this thread

    https://learn.microsoft.com/en-us/answers/questions/1290947/azure-vm-rdp-connection-problem

    You can try to connect via serial console too, and access your Linux and check if there are any restrictions,

    Reference: https://docs.microsoft.com/en-us/troubleshoot/azure/virtual-machines/serial-console-linux

     

    You can disable the firewall for test (systemctl stop ufw) systemctl stop firewalld and Iptables -F

    or

    setenforce 0

     

    Remembering that usually ssh root login is blocked

    Get in touch if you need more help with this issue.

    --please don't forget to "[Accept the answer]" if the reply is helpful--


  2. Mbongeni Maiketso 5 Reputation points
    2023-06-06T19:53:24.69+00:00

    I cannot connect from my local machine, even using telnet.

    User's image


  3. Luca Lionetti 3,211 Reputation points
    2023-06-06T20:11:45.73+00:00

    Hi,

    Welcome to Microsoft Q&A community forum!

    Did you check if the ssh service is up?

    check with

    sudo systemctl status ssh

    if it's down use

    sudo systemctl start ssh

    to start it

    also check if it's listening on port 22

    sudo netstat -lntp | grep 22

    try also to connect form the server itself using

    ssh user@127.0.0.1

    let me know the output

    Cheers

    Luca

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


  4. Akumar 0 Reputation points
    2024-09-26T17:19:36.01+00:00
    • to check for a remote port you may try Port checker website
    • to check for a local port try sudo netstat -ntlp from a linux machine
    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.