Gcp ssh issue . Error :- connection refused - google-cloud-platform

I have a google instance which is initally working fine. But suddenly not able to ssh that system. Cross check firewall ,ssh keys from side and that look fine.

The issue is to brief, but it's confirmed it's not firewall related as it returns "connection refused", you should use ssh -v option to print more useful details
The other thing you should try out is the SSH from GCloud console, but remember to disable Firewall temporarily as GCloud console has a dynamic IP

Related

Google Compute Engine Unable to Access VM

I am unable to ssh into a VM on GCP Compute Engine
However, when I run the command with the --troubleshoot flag, it seems like everything is okay.
When I connect through the console, I get an error message saying "You cannot connect to the VM instance because of an unexpected error".
Also, other people from my organization are able to connect.
I am unable to figure out what the error is. Any help would be appreciated.
From the error message that you got "Permission denied (publickey)" you can check this documentation for further troubleshooting.
Further more you can investigate also the Identity-Aware Proxy (IAP).
If you use Identity-Aware Proxy (IAP) for TCP forwarding, update your custom firewall rule to accept traffic from IAP, then check your IAM permissions.
Update your custom firewall rule to allow traffic from 35.235.240.0/20, the IP address range that IAP uses for TCP forwarding. For more information, see Create a firewall rule.
Grant permissions to use IAP TCP forwarding, if you haven't already done so.
For the error message "You cannot connect to the VM instance because of an unexpected error".
The VM is booting up and sshd is not running yet. You can't connect to a VM before it is running.
To resolve this issue, wait until the VM has finished booting and try to connect again.
The firewall rule allowing SSH is missing or misconfigured. By default, Compute Engine VMs allow SSH access on port 22. If the default-allow-ssh rule is missing or misconfigured, you won't be able to connect to VMs.
To resolve this issue, Check your firewall rules and re-add or reconfigure default-allow-ssh.
sshd is running on a custom port. If you configured sshd to run on a port other than port 22, you won't be able to connect to your VM.
To resolve this issue, create a custom firewall rule allowing tcp traffic on the port that your sshd is running on using the following command:
gcloud compute firewall-rules create FIREWALL_NAME \
--allow tcp:PORT_NUMBER
For further troubleshooting on SSH you see this documentation on Common SSH errors.

Attempt to connect to SSH leads to inability to use VScode via attempting to set up SSH host indefinitely

This is what I see after I try to set up my SSH
So, I was trying to connect my VSCode to the AWS EC2 Instance. After I installed the SSH Host extension, I set up a new SSH target by clicking on the SSH - Host tab. I then typed in what amazon web services told me to in order to connect(ex: ssh -i "notTheRealKey.pem#ec2..."). Note, that is just an example link, not the one I actually used. However, I seem to be indefinitely setting up the SSH host and now I can't do anything with my VScode software. I can't even open a file! It doesn't work by reinstalling the software, either. Does anybody have a solution?
This configuration is stored in the ssh config file on your system. You can remove it by editing ~/.ssh/config and removing the bad entry.

It won't let me connect to my instance's ssh

It won't let me connect to the instance's ssh it just keeps loading, I tried to delete it and create it again but nothing, still check the firewall and the ports are not causing an echo.
I had a similar issue with the web console built-in client. Clean browser cache, try a different browser, use gcloud compute ssh from cli or cloud shell. BTW, if it's an access issue (however you should have received an error in ssh window in this case) - you'll see same problem in command line, if it's a browser issue cli will work.

Cannot connect o google cloud VM

When trying to connect to my google cloud RDP i receive an error saying that my RDP is offline when it is not. At first I thought the error was on my side, but after trying with another RDP it worked fine, any ideas?
You should first check that port 3389 is open on the GCE firewall. If not, run a command like this to create the rule $ gcloud compute firewall-rules create rdp --allow tcp:3389 --source-ranges 0.0.0.0/0 . More info is available here.
Here is a document to troubleshoot RDP issues, you can try these steps. Also you can connect to the instance using a serial console.

SSH browser doesn't work in Compute Engine GCP

When i click the SSH button in the Complete Engine page, the shell window pops up and it shows that the ssh keys are being migrated. After that dialog disappears, nothing happens. I get a blank page without any prompt.
If you're using Firefox (same as me). This seems to be the problem as chrome works fine. Apparently Firefox has a bug. Idk if it's an actual bug or it's done on purpose because sometimes (less times) this works on Firefox and then sometimes doesn't unless I keep and keep reopening an closing the SSH.
Instead of opening and closing every time hoping for a chance to work and or using chrome, If you have linux or in my case I have Windows subsystem for Linux on my windows computer, so I can just SSH to it.
For windows, you could use the subsystem, or use Putty (Here's a putty tutorial https://www.youtube.com/watch?v=fmh94mNQHQc on how to connect to GCC) That putty tutorial is also similar to how you can do it on the subsystem so you can still watch it for that too
It's a bug in a Chromium library that affects Firefox. Use Chrome as a workaround.
To use the browser to SSH to a GCE instance, you need to be a compute instance admin. Also, if you run that instance with a Service Account, your account need to be a Service Account user. Check this link for more information: https://cloud.google.com/compute/docs/ssh-in-browser
In addition, did you check that your firewall allows connections to SSH port (22) from Google IP ranges ?
You can find them by using these commands (see https://support.google.com/a/answer/60764)
nslookup -q=TXT _netblocks.google.com 8.8.8.8
nslookup -q=TXT _netblocks2.google.com 8.8.8.8
nslookup -q=TXT _netblocks3.google.com 8.8.8.8
You can try different methods of connecting an instance to see if the issue is underlying at SSH or somewhere else.
There are several ways to connect a Linux instance via the SSH. You can connect to an instance via the terminal. You can connect via the Cloud Console Web UI which is in general the most convenient way to connect to an instance. Also, you can use Google Cloud SDK and run below command to connect to an instance via SSH:
$ gcloud compute ssh [INSTANCE_NAME]
You can also use Cloud Shell to connect your instance from the Cloud Console web UI by using the same command as above. You can connect via the serial console using the Google Cloud Platform Console, the gcloud command-line tool, or a third-party SSH client. The serial console authenticates users with SSH keys. Specifically, you must add your public SSH key to the project or instance metadata, and store your private key on the local machine from which you want to connect. There are other advanced methods to connect to an instance.
I would also recommend to check if you have firewall rule for port 22 which is required for SSH. You can go to the VPC Network from Cloud Console and then Firewall Rules tab, check if you have firewall rule for port 22 and that rule applied to affected instance or not. If there no firewall rule for port 22, create firewall rule and apply to the affected instance.
You can also follow this SSH troubleshooting steps mentioned at this link.
I have the same problem and after recreating 4 instances and going thru every possible ssh key scenario I decided to try chrome and it worked fine whereas in firefox i get the blank black screen after the key handshake. I watched thru the serial port and the sys log showed all of the same entries for my broken web ssh session in firefox as it did for the working chrome web ssh session which means it has to be a problem with firefox.
Same issue. Ad blocker was to blame. Try whitelisting, disabling or use a private window.