无法使用SSH登录AWS EC2 ubuntu AMI
我正在尝试连接aws提供的标准指南 抛出错误无法使用SSH登录AWS EC2 ubuntu AMI,ubuntu,amazon-web-services,ssh,Ubuntu,Amazon Web Services,Ssh,我正在尝试连接aws提供的标准指南 抛出错误 ssh: Could not resolve hostname public_dns: nodename nor servname provided, or not known ssh: connect to host public_ip port 22: Connection refused 现在我尝试使用公共ip而不是公共dns, 再次抛出一个错误 ssh: Could not resolve hostname public_dns: nod
ssh: Could not resolve hostname public_dns: nodename nor servname provided, or not known
ssh: connect to host public_ip port 22: Connection refused
现在我尝试使用公共ip而不是公共dns,
再次抛出一个错误
ssh: Could not resolve hostname public_dns: nodename nor servname provided, or not known
ssh: connect to host public_ip port 22: Connection refused
我检查了我的ubuntu服务器上的安全组,它的入站对所有ip地址都启用了ssh,并且正在监听端口22。我试图将key.pem内容复制到本地计算机上的.ssh/id\u rsa文件中。还没有成功。我认为我的本地机器ssh配置有问题
本地机器:MacBook Air
如有任何建议/资源,我们将不胜感激。如果有人能给我指出ssh客户机配置方面的资源,这样我就可以更仔细地看一看了,那也太好了。谢谢
******更新******
使用后的输出-vvv
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 103: Applying options for *
ssh: Could not resolve hostname public_dns: nodename nor servname provided, or not known
这是我的ssh_配置文件的外观:
# $OpenBSD: ssh_config,v 1.26 2010/01/11 01:39:46 dtucker Exp $
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.
# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.
Host *
SendEnv LANG LC_*
# Configuration options and default values (see ssh_config(5) for their meaning):
#
# Host # (no default)
# AddressFamily any
# AskPassGUI yes # (Apple only)
# BatchMode no
# BindAddress # (no default)
# ChallengeResponseAuthentication yes
# CheckHostIP yes
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour
# ClearAllForwardings no
# Compression no
# CompressionLevel 6
# ConnectionAttempts 1
# ConnectTimeout # (no default)
# ControlMaster no
# ControlPath # (no default)
# ControlPersist no
# DynamicForward
# EnableSSHKeysign no
# EscapeChar ~
# ExitOnForwardFailure no
ForwardAgent yes
ForwardX11 yes
ForwardX11Timeout 1200
ForwardX11Trusted no
XauthLocation xauth
# Default is to search $PATH. It is recommended that a full path be provided.
# GatewayPorts no
# GlobalKnownHostsFile /etc/ssh/ssh_known_hosts,/etc/ssh/ssh_known_hosts2
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# HashKnownHosts no
# HostbasedAuthentication no
# HostKeyAlgorithms ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss
# HostKeyAlias # (no default)
# HostName # (set by command at run-time)
# IdentitiesOnly no
# IdentityFile .ssh/id_rsa,.ssh/id_dsa
# IPQoS lowdelay
# KbdInteractiveAuthentication yes
# KbdInteractiveDevices # (no default)
# KexAlgorithms ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
# LocalCommand # (no default)
# LocalForward # (no default)
# LogLevel INFO
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96
# NoHostAuthenticationForLocalhost no
# NumberOfPasswordPrompts 3
# PasswordAuthentication yes
# PermitLocalCommand no
# PKCS11Provider # (no default)
Port 22
# PreferredAuthentications gssapi-with-mic,hostbased,publickey,keyboard-interactive,password # (set by ssh at run-time)
# Protocol 2
# ProxyCommand # (no default)
# PubkeyAuthentication yes
# RekeyLimit 0
# RemoteForward # (no default)
# RequestTTY auto
# RhostsRSAAuthentication no
# RSAAuthentication yes
# SendEnv # (no default)
# ServerAliveCountMax 3
# ServerAliveInterval 0
# StrictHostKeyChecking ask
# TCPKeepAlive yes
# Tunnel no
# TunnelDevice any:any
# UsePrivilegedPort no
# User # (set by command at run-time)
# UserKnownHostsFile ~/.ssh/known_hosts,~/.ssh/known_hosts2
# VerifyHostKeyDNS no
# VisualHostKey no
# XAuthLocationi xauth
# XAuthLocation added by XQuartz (http://xquartz.macosforge.org)
Host *
XAuthLocation /opt/X11/bin/xauth
请尝试使用-vvv标志运行ssh,并将结果发布到此处。可能您已经停止并重新启动了服务器,并且它已经更改了IP?如果公共dns没有解析,可能是因为它不再可用。请从ec2控制台仔细检查服务器公共名称和公共ip。@StefanoFalsetto,我已经仔细检查了公共dns。这是针对正在运行的实例的。等等,您是否真的要键入
ssh-i absolute\u path\u to\u key/key.pemubuntu@public_dns
?或者你正在用这个字符串替换你的ssrver的公共dns以避免公开共享?我正在替换它以避免公开共享。