简体   繁体   English

当 ssh 到谷歌云计算引擎中新添加的用户时,权限被拒绝错误

[英]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 用户,并使用以下命令添加了一个新的系统用户

  1. 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

  2. created a sudouser by running running this command sudo adduser admin_user通过运行此命令sudo adduser admin_user

  3. 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

  4. 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) 错误的可能原因是:

  1. Your key expired and Compute Engine deleted your ~/.ssh/authorized_keys file.您的密钥已过期,Compute Engine 删除了您的~/.ssh/authorized_keys文件。

  2. You used an SSH key stored in metadata to connect to a VM that has OS Login enabled.您使用存储在元数据中的 SSH 密钥连接到启用了 OS Login 的 VM。

  3. 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。

  4. You connected using a third-party tool and your SSH command is misconfigured.您使用第三方工具连接,并且您的 SSH 命令配置错误。

  5. 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.

相关问题 在 Compute Engine 上安装 Google Cloud SDK:权限被拒绝错误 - installing Google Cloud SDK on Compute Engine: permission denied error 谷歌云计算引擎操作系统登录权限被拒绝问题 - Google Cloud Compute Engine OS Login permission denied issue 无法连接谷歌计算引擎,获取权限被拒绝错误 - Unable to connect google compute engine, getting permission denied error Google云端存储,计算引擎和不足的权限错误 - Google Cloud Storage, Compute Engine and Insufficient Permission error 尝试通过SSH连接到Google Cloud Shell时出现权限被拒绝(公钥)错误 - Permission denied (publickey) error when trying to connect to Google Cloud Shell via SSH 以其他ssh用户身份访问Google Compute Engine - Accessing Google Compute Engine as a different ssh user SSH 在控制台谷歌云权限被拒绝(公钥)与 google-cloud-sdk 文件错误 - SSH on console google cloud permission denied (publickey) with google-cloud-sdk file error 错误1045:使用Google Cloud SQL在Google Compute Engine中设置PHPMyAdmin时,访问被拒绝 - Error 1045: access denied while Setting up PHPMyAdmin in Google Compute Engine using Google Cloud SQL 谷歌云 TPU:gcloud 计算 tpu 创建失败,权限被拒绝 - Google Cloud TPU: gcloud compute tpus create failing with permission denied 从谷歌云计算中提取 docker 的权限被拒绝 - Permission denied on docker pull from Google Cloud Compute
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM