0

I try to connect VM on ssh got Permission denied (publickey) so i try on cloudshell and try to make key on vm still got same problem

[enter code here][1]to set key and update metadata when i put `ssh [instance name] [zone] [project id]

still Permission denied (publickey)

what should i do next try to open port 22 still same problem even log on serial port all so got login problem loop

gcloud compute firewall-rules list 

and add

gcloud compute firewall-rules create default-allow-ssh --allow tcp:22

problem still the same can login or connect ssh

try to make new key to ssh key on console and make startup-script `#! /bin/bash useradd -G sudo username echo 'username:password.' | chpasswd

!/bin/bash

/usr/sbin/ufw allow 22/tcp`

enter image description here enter image description here

  • For me the problem is here " sbin/ufw " ubuntu firewall may be messing witt the ports (ip tables) or something in your instance, Can you share to us the output of this command ' nmap [EXT_IP] ' ? – Jujosiga May 13 '20 at 13:24
  • Also please share to us the complete error message you are getting from the console by connecting to it via gcloud command and adding --log-http flag at the end of the command: https://cloud.google.com/sdk/gcloud/reference/compute/ssh avoiding sharing PII – Jujosiga May 13 '20 at 13:38
  • i didi it and still chack_b@cloudshell:~ (a4dwork)$ gcloud compute firewall-rules create --network=NETWORK \ > default-allow-ssh --allow=tcp:22 Creating firewall...failed. ERROR: (gcloud.compute.firewall-rules.create) Could not fetch resource: - The resource 'projects/a4dwork/global/firewalls/default-allow-ssh' already exists chack_b@cloudshell:~ (a4dwork)$ sbin/ufw -bash: sbin/ufw: No such file or directory chack_b@cloudshell:~ (a4dwork)$ – Chack Bunnag May 14 '20 at 10:22
  • @Jujosiga I cant use code namp. it's show command not found – Chack Bunnag May 14 '20 at 10:24
  • You may need to install it first, you can do the nmap from any machine you have https://nmap.org/ this will ensure us if the issue is inside your VM instance or in the GCP configuration like SSH keys or Firewall rules. – Jujosiga May 14 '20 at 14:24

0 Answers0