[GO] What to do if you enable UFW on Ubuntu VM on GCP and you can't connect to SSH

Problems faced

After playing around with GCP's Ubuntu VM, I disconnected with UFW enabled => rebooted and couldn't connect to ssh.

This solved it

Write a startup script that disables UFW as custom metadata in the VM instance information. Then restart the VM instance.

UFW disabled.sh


#! /bin/bash
/usr/sbin/ufw disable

↓ Like this. It is recognized as a startup script by using startup-script as a key. image.png

Recommended Posts

What to do if you enable UFW on Ubuntu VM on GCP and you can't connect to SSH
What to do if you install Ubuntu
Ssh to Ubuntu on VirtualBox on your Mac and do it until you install Docker
What to do if you can't use the rails command
[Rails] What to do if you can't get parameters with form_with
What to do if you can't install the plugin from the Eclipse marketplace
What to do if you get a MiniMagick vulnerability alert on GitHub
What to do if you can't bundle update and bundle install after installing Ruby 3.0.0 in the Rails tutorial
What to do if you push incorrect information
What to do if you can't activate the select box created by bootstrap-select
What to do if you have installed Java for OS X on macOS
What to do if you get an error on heroku rake db: migrate
What to do if the Rails server can't start
What to do if rails server can't be stopped
What to do if TextToSpeech doesn't work on Android 11
What to do if you accidentally create a model
What to do when booting Ubuntu on WSL2 and getting "Process terminated with code 1"
What to do if you can't get the text of an element in Selenium
What to do if you get a NoClassDefFoundError when trying to run eclipse on Java9
What to do if you can't find your API key after deploying to Rails heroku
What to do if you get a port error when docker-compose up on Mac
What to do if you can't find the JDK you put in SDKMAN after migrating from bash to zsh on macOS
What to do if you get a java.io.IOException in GlassFish
What to do if audio is not available on discordrb
# What to do if you accidentally do rails db: migrate: drop
[Rails] What to do if you can't get an error message with the errors method
Notes on what to do if Ubuntu 20.04 installation on Virtual box 6.1 (Windows10) fails with "Error 5 Input / output error"
What to do if you go offline due to SSL certificate error when running Jenkins on Mac
[Ubuntu 20.04] What to do if the external monitor is not recognized
What to do if you get a gcc error in Docker
If you can't hear sound from your Bluetooth headphones on Ubuntu 20.04
What to do if you get a DISPLAY error in gym.render ()
What to do if you get angry with OpenSSL with pyenv install
Install Ubuntu Server 20.04 in VirtualBox on Mac and connect with SSH
What to do if you forget the root password in CentOS7
What to do if you cannot roll back the migration (UnknownMigrationVersionError)
Enable Java 8 and Java 11 SDKs on Ubuntu
What to do if you get the error Too long with no output (exceeded 10m0s) on CircleCI
What to do if you get a groovy warning in Thymeleaf Layout
What to do if you get an error during rails db: reset
[Composer] [Laravel] What to do if you cannot install due to insufficient memory
What to do if you get an uninitialized constant Likes Controller error
What to do if deployment fails on Heroku (Ruby app not detected)
no space left on device What to do if an error occurs
What to do if you don't like the code generated by swagger-codegen-cli
What to do if you get an error when you hit Heroku logs
Connect to Amazon EC2 with SSH (Ubuntu)
Serially connect to Ubuntu on Raspberry Pi
What to do if you switch Java versions on Windows 7 and get Error: Registry key'Software \ JavaSoft \ Java Runtime Environment'\ CurrentVersion' has value '1.8', but '1.7' is required.
What to do when you think you can't do Groovy-> Java in IntelliJ IDEA CE
What to do if you get Could not locate Gemfile or .bundle / directory
What to do if you get the error message unrecognized selector send to instance "***"
What to do if Docker Desktop fails to launch on your M1 MacBook Pro
What to do if you get angry if you don't have nokogiri while installing wp2txt
What to do if you get To install the missing version, run `gem install bundler: 2.1.4`
What to do when "Nil location provided. Can't build URI." Appears on CarrierWave
What to do if the rails server doesn't run out on AWS cloud9
What to do if you hit the wall of Too many symbol files when uploading with App Store Connect
What to do if you try to start GlassFish and it becomes java.lang.UnsupportedClassVersionError: org / glassfish / admin / cli / AsadminMain: Unsupported major.minor version 51.0
[Solution] What to do if you get a Docker error'ERROR: Cannot connect to the Docker daemon at unix: ///var/run/docker.sock. Is the docker daemon running?'
How to configure ubuntu to be used on GCP