gpt4 book ai didi

azure - 无法通过 VS code 连接 Azure ubuntu VM

转载 作者:行者123 更新时间:2023-12-03 03:33:11 25 4
gpt4 key购买 nike

通过 VSCode 连接 Azure VM 时出现以下问题,但当我们使用 .ppk 文件时,我们可以通过 Putty 连接。当我们在 VSCode 中使用 ssh 配置同时使用 .ppk 和 .pem 时,出现以下错误。错误:权限被拒绝(公钥)

以下是 ssh 日志:root@VMWDEPOCEUS001:/var/log# tail -30 auth.log 10 月 27 日 10:19:12 VMWDEPOCEUS001 sshd[3087]:来自 156.163.33.75 端口 56425 ssh2 的无效用户 ssh 用户的密码失败 10 月 27 日 10:19 :14 VMWDEPOCEUS001 sshd[3087]:来自 156.163.33.75 端口 56425 ssh2 的无效用户 ssh 用户密码失败 10 月 27 日 10:19:15 VMWDEPOCEUS001 sshd[3087]:无效用户 ssh 用户 156.163.33.75 端口 564 重置连接25 [预授权] 10 月 27 日 10:23:52 VMWDEPOCEUS001 sshd[3095]:来自 156.163.33.75 端口 56590 的无效用户 ssh user1 10 月 27 日 10:23:57 VMWDEPOCEUS001 sshd[3095]:来自 156.163.33 的无效用户 ssh user1 没有失败。 75端口56590 ssh2 10 月 27 日 10:24:00 VMWDEPOCEUS001 sshd[3095]:来自 156.163.33.75 端口 56590 ssh2 的无效用户 ssh user1 的密码失败 10 月 27 日 10:24:04 VMWDEPOCEUS001 sshd[3095]:来自 156 的无效用户 ssh user1 的密码失败。 163. 33.75 端口 56590 ssh2 10 月 27 日 10:24:05 VMWDEPOCEUS001 sshd[3095]:无效用户重置连接 ssh user1 156.163.33.75 端口 56590 [preauth] 10 月 27 日 10:25:26 VMWDEPOCEUS001 sshd[3099]:接受的密码对于 user1 来自156.163.33.75 端口 56649 ssh2 10 月 27 日 10:25:26 VMWDEPOCEUS001 sshd[3099]:pam_unix(sshd:session):由 (uid=0) 10 月 27 日 10:25:26 VMWDEPOCEUS001 systemd-logind[1238 为用户 user1 打开 session ]:用户user1的新 session 6。 10 月 27 日 10:25:28 VMWDEPOCEUS001 sshd[3167]:从 156.163.33.75 端口 56651 ssh2 接受 user1 的密码 10 月 27 日 10:25:28 VMWDEPOCEUS001 sshd[3167]:pam_unix(sshd:session):为用户 user1 打开的 session (uid=0) 10 月 27 日 10:25:28 VMWDEPOCEUS001 systemd-logind[1238]:用户 user1 的新 session 7。 10 月 27 日 10:27:00 VMWDEPOCEUS001 sshd[3258]:来自 156.163.33.75 端口 26689 的用户 ssh user1 无效 10 月 27 日 10:27:14 VMWDEPOCEUS001 sshd[3258]:pam_unix(sshd:auth):检查通过;用户未知 10 月 27 日 10:27:14 VMWDEPOCEUS001 sshd[3258]:pam_unix(sshd:auth):身份验证失败; logname= uid=0 euid=0 tty=ssh ruser= rhost=156.163.33.75 10 月 27 日 10:27:16 VMWDEPOCEUS001 sshd[3258]:来自 156.163.33.75 端口 26689 ssh2 的无效用户 ssh user1 的密码失败 10 月 27 日 10:27 :30 VMWDEPOCEUS001 sshd[3258]: pam_unix(sshd:auth): 检查通过;用户未知 10 月 27 日 10:27:33 VMWDEPOCEUS001 sshd[3258]:来自 156.163.33.75 端口 26689 ssh2 的无效用户 ssh user1 的密码失败 10 月 27 日 10:27:47 VMWDEPOCEUS001 sshd[3258]:pam_unix(sshd:auth):检查经过;用户未知 10 月 27 日 10:27:49 VMWDEPOCEUS001 sshd[3258]:来自 156.163.33.75 端口 26689 ssh2 的无效用户 ssh user1 的密码失败 10 月 27 日 10:27:49 VMWDEPOCEUS001 sshd[3258]:无效用户 ssh user1 156.1 重置连接63 .33.75 端口 26689 [preauth] Oct 27 10:27:49 VMWDEPOCEUS001 sshd[3258]:PAM 2 更多身份验证失败; logname= uid=0 euid=0 tty=ssh ruser= rhost=156.163.33.75 10 月 27 日 10:31:22 VMWDEPOCEUS001 sshd[3279]:来自 156.163.33.75 端口 56826 的用户 ssh user1 无效 10 月 27 日 10:31:34 VMWDEPOCEUS00 1 个固态硬盘[3279]: pam_unix(sshd:auth): 检查通过;用户未知 10 月 27 日 10:31:34 VMWDEPOCEUS001 sshd[3279]:pam_unix(sshd:auth):身份验证失败; logname= uid=0 euid=0 tty=ssh ruser= rhost=156.163.33.75 10 月 27 日 10:31:35 VMWDEPOCEUS001 sshd[3279]:来自 156.163.33.75 端口 56826 ssh2 的无效用户 ssh user1 的密码失败 10 月 27 日 10:32 :09 VMWDEPOCEUS001 sshd[3279]: pam_unix(sshd:auth): 检查通过;用户未知 10 月 27 日 10:32:10 VMWDEPOCEUS001 sshd[3279]:来自 156.163.33.75 端口 56826 ssh2 的无效用户 ssh user1 的密码失败

预期:需要使用 VSCode 配置文件连接到 Azure Ubuntu (18.04) VM

最佳答案

我尝试在我的环境中重现相同的情况,SSH 已成功使用 VSCode 连接到 Azure Ubuntu (18.04) VM。

enter image description here

根据 Docs Putty 不支持发生错误。尝试安装OpenSSH客户端

将您的用户更改为 root:

sudo -s

尝试安装ssh,或者如果已经安装更新它并启用您的ssh并检查您的状态是否处于事件状态如下所示

sudo apt-get install ssh    
sudo apt-get update
systemctl enable ssh.service
systemctl status ssh.service

enter image description here

生成ssh key 。尽量避免ssh -i,请在配置 ssh 主机时使用user@hostname,如下所示。

enter image description here

检查您是否提供了配置文件主机、用户和主机名是否正确。

当我尝试连接时,我收到了相同的错误和 ssh 日志,如下所示。

enter image description here enter image description here

要解决此问题:

首先尝试使用sudo passwd root更改密码更新密码并启用密码身份验证运行sudo nano/etc/ssh/sshd_config它将打开nano编辑器,如下所示.

enter image description here

一旦您的 Nano 编辑器更改了文件系统权限,您向下滚动将光标放在 # 按 insert insert 类型 PermitRootlogin yes pubkeyauthentication yes 按 escape &: x Enter

enter image description here

按照以下命令重新启动 SSH 服务:

sudo systemctl reload sshd

并尝试使用 ssh user@hostname 连接,成功。

如果您仍然遇到问题,请检查 root ssh 安装并更新检查状态是否处于事件状态,位于上方并在 Nano 编辑器中检查

PasswordAuthentication
ChallengeResponseAuthentication
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
UsePAM yes

enter image description here

enter image description here

要了解更多详细信息,请引用此链接:

SSH Failed Permission Denied 作者:phoenixnap

Connect over SSH with Visual Studio Code

关于azure - 无法通过 VS code 连接 Azure ubuntu VM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74222103/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com