首页 > 解决方案 > ssh:无法解析主机名 ubuntu:名称解析暂时失败

问题描述

我正在尝试实现一个 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------- 1 anders anders 137 May 26 06:26 /home/anders/.ssh/config

希望有人可以帮助解决这个问题。提前谢谢

标签: sshssh-config

解决方案


这最终对我有用,除非有人回答为什么我的不起作用这是解决方案

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

推荐阅读