2

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.

4

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.

0
0

you can run ssh-host-config

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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