I've got problem with connecting to my VM running on Linux. Recently I was playing with SSH server configuration and I set listening on port 2222. But now I can't connect to this server. How can I reset this settings ?

I've tried following, but it's not working:

ssh [email protected]
ssh [email protected] -p 2222

The question is how can I connect to my machine?

EDIT: I've already solved it - in Azure VM settings I reset SSH configuration.


2 Answers 2


When you change ssh port to other port, you need open port on Azure NSG. By default, for a Linux VM, only port 22 is open. So, when you change the port to other, you could not ssh to the VM.

enter image description here

When you rest ssh configuration on Azure Portal, it will change port to 22. So, you could ssh to your VM again.

  • Ooh yes, of course. Thanks for explanation, I forgot to do this.
    – Jozef Cipa
    Commented Aug 7, 2017 at 5:44

Solved by reseting SSH configuration in VM setting on Azure portal.enter image description here

  • You could change ssh port to 2222, the root reason that you could not ssh to your VM is you not open port 2222 on Azure NSG. If possible, I suggest you could test again. Commented Aug 7, 2017 at 5:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .