ssh:无法解析主机名ubuntu:名称解析暂时失败

ssh:无法解析主机名ubuntu:名称解析暂时失败,ssh,ssh-config,Ssh,Ssh Config,我正在尝试实现一个ssh配置文件。不久前,它正在使用一个不同的ec2实例,所以我不确定这里有什么不同。我可以ssh-I“key.pem”ubuntun@ipaddress很好,但是当我使用我的配置文件ssh ubuntu时,我得到了以下错误 debug1: Reading configuration data /home/anders/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/s

我正在尝试实现一个ssh配置文件。不久前,它正在使用一个不同的ec2实例,所以我不确定这里有什么不同。我可以
ssh-I“key.pem”ubuntun@ipaddress
很好,但是当我使用我的配置文件
ssh ubuntu
时,我得到了以下错误

debug1: Reading configuration data /home/anders/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
ssh: Could not resolve hostname ubuntu: Temporary failure in name resolution
我的配置如下所示

Host fsdfs.compute.amazonaws.com
User ubuntu
Port 22
IdentitiesOnly yes
IdentityFile ~/.ssh/fds-fds-dsfs.pem
当我在.ssh上运行ls-ld时
drwx-----2 anders anders 4096 May 26 06:45/home/anders/.ssh

当我在.ssh/config上运行ls-ld时,我得到
-rw------1anders-anders 137 May 26 06:26/home/anders/.ssh/config


希望有人能帮上忙。提前感谢

除非有人能回答为什么我的不起作用,否则这就是解决方案

Host ubuntu  
  HostName fsdf.us-east-2.compute.amazonaws.com
  User ubuntu
  Port 22
  IdentitiesOnly yes
  IdentityFile ~/.ssh/fds-dfas-fdsa.pem

这最终对我有效,除非有人能回答为什么我的不起作用,这就是解决办法

Host ubuntu  
  HostName fsdf.us-east-2.compute.amazonaws.com
  User ubuntu
  Port 22
  IdentitiesOnly yes
  IdentityFile ~/.ssh/fds-dfas-fdsa.pem

在“配置”文件中添加以下配置

配置文件的位置为“~/.ssh/config”

然后从实例1执行ssh hostname2,就可以从实例1连接到实例2


在这里,hostname2将是实例2中在“vim/etc/hosts”位置配置的主机名。

在“config”文件中添加以下配置

配置文件的位置为“~/.ssh/config”

然后从实例1执行ssh hostname2,就可以从实例1连接到实例2

在这里,hostname2将是实例2中在“vim/etc/hosts”位置配置的主机名