我无法通过 SSH 连接到我在 AWS 控制台中创建的 EC2 实例。当我输入此命令时,我只会看到闪烁的光标:
ssh -i "ansible.pem" [email protected]
这是我在终端上得到的结果:
root@OMEN:/home/krillavilla/ansible# ssh -vv "ansible.pem" [email protected]
OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "ansible.pem" port 22
ssh: Could not resolve hostname ansible.pem: Name or service not known
root@OMEN:/home/krillavilla/ansible# ssh -i "ansible.pem" [email protected]
我尝试过重启 sshd 服务,卸载 sshd 并重新安装。但都不起作用。
更新*
正确命令:
root@OMEN:/home/krillavilla/ansible# ssh -vv -i "ansible.pem" [email protected]
OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "ec2-52-34-81-7.us-west-2.compute.amazonaws.com" port 22
debug1: Connecting to ec2-52-34-81-7.us-west-2.compute.amazonaws.com [52.34.81.7] port 22.
debug1: connect to address 52.34.81.7 port 22: Connection timed out
ssh: connect to host ec2-52-34-81-7.us-west-2.compute.amazonaws.com port 22: Connection timed out
答案1
我弄清楚了这个问题。
是咖啡厅的wifi,我换了wifi,连接成功了。