[英]Permission denied error when ssh to a newly added user in google cloud compute engine
I created a sudo user in a newly created google cloud compute machine (debian) and added a new system user using the below commands我在新创建的谷歌云计算机(debian)中创建了一个 sudo 用户,并使用以下命令添加了一个新的系统用户
ssh into the instance using this command: gcloud compute ssh instance-name --zone=us-central1-a
ssh 使用以下命令进入实例: gcloud compute ssh instance-name --zone=us-central1-a
created a sudouser by running running this command sudo adduser admin_user
通过运行此命令sudo adduser admin_user
I can see the new user gets added by running the below command less /etc/passwd
admin_user:x:1002:1003::/home/admin_user:/bin/sh
我可以看到通过运行以下命令添加了新用户less /etc/passwd
admin_user:x:1002:1003::/home/admin_user:/bin/sh
The user group also I verified by running groups admin_user
.我还通过运行groups admin_user
验证了用户组。 this is the output admin_user: admin_user sudo google-sudoers
这是 output admin_user: admin_user sudo google-sudoers
But when I try to ssh to that instance from my local machine但是当我尝试从本地机器 ssh 到该实例时
gcloud compute ssh --project project_name --zone us-central1-a admin_user@instance-name
its giving the following error.它给出了以下错误。
admin_user@32.29.134.441: Permission denied (publickey).
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
Could anyone please help how to solve this任何人都可以请帮助如何解决这个问题
The possible causes for a Permission denied (publickey) error are: Permission denied (publickey) 错误的可能原因是:
Your key expired and Compute Engine deleted your ~/.ssh/authorized_keys
file.您的密钥已过期,Compute Engine 删除了您的~/.ssh/authorized_keys
文件。
You used an SSH key stored in metadata to connect to a VM that has OS Login enabled.您使用存储在元数据中的 SSH 密钥连接到启用了 OS Login 的 VM。
You used an SSH key stored in an OS Login profile to connect to a VM that doesn't have OS Login enabled.您使用存储在 OS Login 配置文件中的 SSH 密钥连接到未启用 OS Login 的 VM。
You connected using a third-party tool and your SSH command is misconfigured.您使用第三方工具连接,并且您的 SSH 命令配置错误。
The sshd daemon isn't running or isn't configured properly. sshd 守护程序未运行或未正确配置。
It looks like the first one fits the best for you.看起来第一个最适合你。 To solve this error add the SSH keys as it is explained in this link要解决此错误,请按照此链接中的说明添加 SSH 密钥
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.