0

My SSH connection works fine if I do this:

ssh [email protected] -i ~/.ssh/myserver

However if I omit the '-i', it demands a password and I have no idea why. It seems that my SSH client is not configured to check ~/.ssh. I have set 700 permissions on the folder and the files but still nothing : /

2 Answers 2

0

You probably have to change or need to set the IdentityFile in your ssh config.

Edit or Insert the line, into the File /etc/ssh/ssh_conf:

IdentityFile ~/.ssh/myserver

Normaly you only have one private key. If you have multiple private key's it's probably the best way to create "config" file in your ".ssh directory"

host myserver
 Hostname myserver
 user whatever
 port 22
 identityfile ~/.ssh/myserver

Now you can connect to your server by typping

ssh myserver
3
  • Do I need to do this for every identity file? Because that's not how my local computer works, it just finds it by magic. Jul 29, 2014 at 10:21
  • normaly you only have one private key... you don't need to create for each server it's own private key :-)
    – cYris212
    Jul 29, 2014 at 10:22
  • Aahh! It's this misunderstanding that's causing the problem, all works now :) cheers. Didn't even need to write that in the config file, just name it id_dsa Jul 29, 2014 at 10:25
0

Possible solution, add something like this to your .ssh/config file:

host myserver
hostname myserver.com
identityfile ~/.ssh/myserver
user myuser

and you'll be fine with 'ssh myserver'.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .