我可以在无法通过 SSH 登录的情况下恢复 esxi 5.5 上的 sshd_config 文件吗?

我可以在无法通过 SSH 登录的情况下恢复 esxi 5.5 上的 sshd_config 文件吗?

我尝试过寻找方法,但不确定如何在 ESXI 机器上获取本地 shell 访问权限。
我对 sshd_config 文件进行了以下更改,从而破坏了 sshd_config:

# Default > MACs hmac-sha1,hmac-sha1-96
MACs hmac-sha2-256,hmac-sha2-512,hmac-sha1

进行更改后,重新启动 ssh 服务:

$ ssh -l root 10.240.19.22
ssh_exchange_identification: Connection closed by remote host

$ ssh -l root 10.240.19.22 -vvv
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/user/.ssh/config
debug1: /Users/user/.ssh/config line 1: Applying options for *
debug3: kex names ok: [diffie-hellman-group1-sha1]
debug3: kex names ok: [diffie-hellman-group1-sha1]
debug3: kex names ok: [diffie-hellman-group1-sha1]
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: resolve_canonicalize: hostname 10.240.19.22 is address
debug2: ssh_connect_direct
debug1: Connecting to 10.240.19.22 [10.240.19.22] port 22.
debug1: Connection established.
debug1: identity file /Users/user/.ssh/id_rsa type -1
debug1: identity file /Users/user/.ssh/id_rsa-cert type -1
debug1: identity file /Users/user/.ssh/id_dsa type -1
debug1: identity file /Users/user/.ssh/id_dsa-cert type -1
debug1: identity file /Users/user/.ssh/id_ecdsa type -1
debug1: identity file /Users/user/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/user/.ssh/id_ed25519 type -1
debug1: identity file /Users/user/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/user/.ssh/id_xmss type -1
debug1: identity file /Users/user/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
ssh_exchange_identification: Connection closed by remote host

有什么恢复的想法吗?谢谢!

答案1

我认为唯一的方法是将远程服务器视为本地服务器:

  1. 获取远程服务器的 ILO/IPMI/KVM 访问权限,
  2. 重启
  3. 当您进入管理控制台时,按如下方式启动本地 shell:

https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.vcli.migration.doc_50%2Fcos_upgrade_technote.1.4.html

  1. 对 sshd.conf 进行编辑并重新启动服务。
  2. 测试远程 SSH。

相关内容