Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unable to connect to SSH about 6 minutes after creating a new VM

I'm setting up a Minecraft server with Google Cloud. What I did was:
Create VM -> SSH via Bitvise -> sudo su -> apt update && upgrade -> apt install openjdk-17-jre-headless -> apt install wget & screen & git -y & zip -> git clone <URL removed by staff>-> cd mcserver -> chmod +x * -> ./install (this installs Minecraft).

About after I uploaded all mods to the VM via Bitvise, I disconnected and attempted to log back into the VM. Then Bitvise told me auth failed.

ShirakamiKaiser_0-1729949605255.png

I have created 5 VMs so far, all of their SSH stopped being functional after a couple minutes and cannot be logged back into.

0 1 84
1 REPLY 1

Hi @ShirakamiKaiser,

Welcome to Google Cloud Community! 

You must create a firewall rule specifically allowing SSH (port 22) traffic to your VM.

Google Cloud Console:

1. Go to "VPC Network" -> "Firewall Rules".

2. Create a new rule:

  • Name: "Allow SSH" (or something descriptive)
  • Target: "All instances" (or specify your VM's tag)
  • Network: Choose the network your VM is connected to (usually the default)
  • Action: "Allow"
  • Protocol and ports: "TCP: 22" 

6fPgjExdhRTBrTY.png

3. Below is the gcloud command line and parameters to use:

gcloud compute firewall-rules create allow-ssh --allow tcp:22 --target-tags=your-vm-tag

Replace your-vm-tag with the tag you assigned to your VM.

For more information here is gcloud reference.


In addition, if your VM stopped or misconfigured it is recommended  to Restart the sshd by running the following command:

systemctl restart sshd.service


Check if there are any errors in the status by running the following command:

systemctl status sshd.service


You may check this documentation to learn more about
Troubleshooting SSH error.

If the issue still persists and needs further assistance, please feel free to reach out to our support team.

I hope the above information is helpful.