authentication - gcloud:ssh-ing到服务器时权限被拒绝(公钥)

标签 authentication ssh instance gcloud public-key

我正在尝试为 gcloud 实例设置一个新的 ssh key 。我按照此处的说明逐字逐句 (https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys),生成一个新 key ,将带有我的用户名的公共(public) rsa-ssh key 放在 Google Cloud Platform 界面中元数据选项卡的 SSH key 部分,并为我的使用 chmod 的公钥和私钥。

尝试使用 -vvv 详细标志进行 ss 时,我收到一个错误,如下所示:

...
debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/erickofman/.ssh/salsadb debug3: send_pubkey_test debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: publickey debug2: we did not send a packet, disable method debug1: No more authentication methods to try. Permission denied (publickey).
我(与一位同事)确保我的公钥包含在服务器的 .ssh 文件夹中的 authorized_keys 文件中。考虑到某些东西可能已经过时,我还尝试使用 service sshd restart 重新启动 ssh 服务器。无济于事。

我还尝试使用 gcloud 工具设置 ssh,结果相同。

据我所知,我拥有该站点的正确角色/权限。

这是日志在服务器端的样子:
admin@awesome-website:~$ tail /var/log/auth.log Nov 15 20:40:16 awesome-website sshd[18846]: input_userauth_request: invalid user ekofman [preauth] Nov 15 20:40:17 awesome-website sshd[18846]: Connection closed by 10.100.100.10 port 90001 [preauth] Nov 15 20:41:17 awesome-website sshd[18848]: Connection closed by 200.200.20.20 port 90002 [preauth]
一直在努力解决这个问题,非常感谢任何帮助!

最佳答案

Whelp,事实证明,除非完全重启实例,否则不会合并新的 ssh key 。不是 ssh 服务器重启,而是完整的实例重启(停止 gcloud 实例,然后启动 gcloud 实例)。它没有在文档中说明这一点,很高兴知道以供将来引用。

关于authentication - gcloud:ssh-ing到服务器时权限被拒绝(公钥),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47316981/

相关文章:

ssh - Ansible sudo 在 5 个任务后挂起

java - 使用 Selenium Webdriver 运行基于 Web 的 SSH CLIENT PLUGIN 脚本的自动化

c# - 如何使用 C# WEB API(基于 token ).net core 对 Azure AD 应用程序进行身份验证和授权

authentication - IIS 7.5 和客户端身份验证

安卓图形登录/密码

c - 通过 SSH 使用 Eclipse 处理远程项目

python - 如何在 Python 中创建类的不同实例?

python - 如何在 Python 中为实例分配属性?

c# - 可以通过反射获取调用方法类的实例,或者调用栈中的任何方法吗?

php - Laravel 5.2 使 :auth