Cygwin的SSH问题:无法parsing主机名awshost1:主机名或服务器名提供,或不知道

我正在学习“启动工程”,使用ssh别名时遇到此错误。 下面是详细的步骤(在Cygwin的Windows 8中执行):

$ mkdir -p ~/.ssh $ cp ~/downloads/skey.pem ~/.ssh/ $ chmod 400 ~/.ssh/skey.pem $ chmod 700 ~/.ssh $ nano ~/.ssh/config $ cat ~/.ssh/config Host awshost1 HostName ec2-54-218-35-71.us-west-2.compute.amazonaws.com User ubuntu IdentityFile "~/.ssh/skey.pem" 

然后我跑下命令

 ssh awshost1 

但它提示

ssh:无法parsing主机名awshost1:主机名或服务名提供,或不知道

而详细的输出:

 $ ssh -vv awshost OpenSSH_6.2p2, OpenSSL 1.0.1e 11 Feb 2013 debug1: Reading configuration data /etc/ssh_config debug2: ssh_connect: needpriv 0 ssh: Could not resolve hostname awshost: hostname nor servname provided, or not known 

有谁能帮我吗? 谢谢。

正如你从输出中看到的,你的ssh-client读取/etc/ssh_config ,而不是~/.ssh/config 。 尝试像这样连接: ssh -F ~/.ssh/config awshost1

你可以运行ssh-host-config

并将你的sshconfiguration放在/etc/ssh_config ,这样可以完美地工作