Cannot connect to VM on port 22

926 views
Skip to first unread message

Lukas Pfeifle

unread,
Sep 19, 2017, 9:00:55 AM9/19/17
to gce-discussion
Hi all,

I enabled 4 rules on my Ubuntu 16.04 VM "sudo ufw allow 7209" and then enabled the firewall "sudo ufw enable". However i forgot to allow port 22 for my ssh connection. I can now no longer connect to my VM and i need the information on it. How can i disable the firewall without using SSH to get to the terminal.

Thanks

Thomas Johnson

unread,
Sep 19, 2017, 9:32:07 AM9/19/17
to gce-discussion
Can you see the FW rule on the GCE console?

Scott Van Woudenberg

unread,
Sep 19, 2017, 10:44:08 AM9/19/17
to Lukas Pfeifle, gce-discussion, Thomas Johnson
Hi Lukas,

You can connect to your VM using the interactive serial console; it doesn't use the normal network path and therefore will work even if your VM's network is down or misconfigured.

--
© 2017 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-discussion@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to the Google Groups "gce-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gce-discussion+unsubscribe@googlegroups.com.
To post to this group, send email to gce-discussion@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gce-discussion/c7d3b3c6-bfec-4b06-b57b-971f2bbeff2b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Faizan (Google Cloud Support)

unread,
Sep 19, 2017, 4:30:56 PM9/19/17
to gce-dis...@googlegroups.com
Hello Lukas,

One more option other than interactive serial console would be to use a startup script to disable or modify the ufw firewall. For example you can use the following startup script to add port 22 to ufw firewall on your VM. You need to restart the VM in order to run the startup script.

#! /bin/bash
ufw allow 22

I hope that helps.

Faizan


On Tuesday, September 19, 2017 at 10:44:08 AM UTC-4, Scott Van Woudenberg wrote:
Hi Lukas,

You can connect to your VM using the interactive serial console; it doesn't use the normal network path and therefore will work even if your VM's network is down or misconfigured.
On Tue, Sep 19, 2017 at 6:24 AM, Thomas Johnson <> wrote:
Can you see the FW rule on the GCE console?


On Tuesday, 19 September 2017 10:00:55 UTC-3, Lukas Pfeifle wrote:
Hi all,

I enabled 4 rules on my Ubuntu 16.04 VM "sudo ufw allow 7209" and then enabled the firewall "sudo ufw enable". However i forgot to allow port 22 for my ssh connection. I can now no longer connect to my VM and i need the information on it. How can i disable the firewall without using SSH to get to the terminal.

Thanks
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce- to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.

---
You received this message because you are subscribed to the Google Groups "gce-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gce-discussion+unsubscribe@googlegroups.com.
To post to this group, send email to.
Reply all
Reply to author
Forward
0 new messages