cannot ssh into vm after changing the default port no for ssh?

Anish S 1 Reputation point

I changed the default ssh port from 22 to a different one and then restarted the ssh service on the vm , and then in order to check the changes are working or not I tried to ssh to the vm on a different powershell window on my machine without logging out of the connected one but I cannot ssh to the vm using the new port no I am getting Connection timed out error . But if I change the port no to default that is 22 I can ssh into the vm can anyone help me with this?

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

1 answer

Sort by: Most helpful
  1. SUNOJ KUMAR YELURU 14,016 Reputation points MVP

    Hi @Anish S
    Thank You for posting in Q & A.

    After changing the default ssh port on the VM, can you verify that new ssh port is added in the NSG rules. once new ssh port is added in the NSG rules or FW you can able to connect on the VM

    If the Answer is helpful, please click Accept Answer and up-vote, this can be beneficial to other community members.

    2 people found this answer helpful.
    0 comments No comments