Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm learning "startup engineering", encountered this error when using ssh alias. Below is the detailed steps (executed in 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"

Then I ran below command

ssh awshost1

But it prompts

ssh: Could not resolve hostname awshost1: hostname nor servname provided, or not known

And the verbose output:

$ 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

Would anyone please help me on this? Thanks.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

As you can see from the output, your ssh-client reads /etc/ssh_config, not ~/.ssh/config. Try to connect like that: ssh -F ~/.ssh/config awshost1.

share|improve this answer
    
It works perfectly, thanks. –  Shinbo Jun 26 '13 at 14:25
add comment

you can run ssh-host-config

and place your ssh config in /etc/ssh_config which will make it work flawlessly

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.