Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
up vote 3 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

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

Your Answer


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.