4

I am trying to implement a ssh config file. It was working with a different ec2 instance moments ago, so I am not sure what is different here. I can ssh -i "key.pem" ubuntun@ipaddress just fine but when I use my config file ssh ubuntu I get the following error

debug1: Reading configuration data /home/anders/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
ssh: Could not resolve hostname ubuntu: Temporary failure in name resolution

My Config looks like the following

Host fsdfs.compute.amazonaws.com
User ubuntu
Port 22
IdentitiesOnly yes
IdentityFile ~/.ssh/fds-fds-dsfs.pem

When I run ls -ld on .ssh I get drwx------ 2 anders anders 4096 May 26 06:45 /home/anders/.ssh

When I run ls -ld on .ssh/config I get -rw------- 1 anders anders 137 May 26 06:26 /home/anders/.ssh/config

Hopefully someone can help with this. Thanks ahead of time

Anders Kitson
  • 1,413
  • 6
  • 38
  • 98

2 Answers2

3

This ended up working for me, unless someone has a answer why mine didn't work this is the solution

Host ubuntu  
  HostName fsdf.us-east-2.compute.amazonaws.com
  User ubuntu
  Port 22
  IdentitiesOnly yes
  IdentityFile ~/.ssh/fds-dfas-fdsa.pem
Anders Kitson
  • 1,413
  • 6
  • 38
  • 98
1

Add the below configuration in the 'config' file

Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null

Location of config file is '~/.ssh/config'

Then do ssh hostname2 from instance-1 and you can able to connect from instance-1 to instance-2.

Here, hostname2 will be the hostname configured in instance-2 in the location 'vim /etc/hosts'

Moorthi Raj
  • 21
  • 1
  • 1
  • 5