I disabled port 22 by mistake on my cloud server and now am not able to ssh it.

I unexpectedly closed port 22 by ufw command (firewall level). Is there any way to login that server? The server is working, but not able to login. Is there any way to disable ufw ?

Alternatively, how can do magic reboot this machine?

  • 1
    If this is a "cloud" server, please give more information in your original question or consult you cloud VPS provider's documentation on how to connect to your server's console or on how to modify the disk image of your server.
    – FedKad
    Aug 22, 2019 at 7:15
  • Hi Jasil, can you give us more details, please? What's the context and share exactly what command you tried to run.
    – Benjamin R
    Aug 22, 2019 at 9:32
  • disabled port 22 by mistaken of my cloud server and now am not able to ssh it @BenjaminR
    – Jasil Op
    Aug 22, 2019 at 9:51
  • Hi Jasil, what cloud service is hosting the server? If it's something like AWS or Azure or GCP it's easy to reboot the instance.
    – Benjamin R
    Aug 23, 2019 at 8:35

1 Answer 1


You need either physical access to the server or console access. It would be really bad if it was possible to reenable access to port without having access to the server, any attacker would be able to do it

  • 1
    Or you need management access to the account in the cloud service hosting the instance/server.
    – Benjamin R
    Aug 23, 2019 at 8:36

You must log in to answer this question.

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