I'm trying to use the .ssh/config file to use identityFile I'm sure the syntax of the file is 100% correct as it only contain two lines.

host *
IdentityFile /path/to/private/key

I tried -vvv and I get this error at the end of the trial

debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

when i use ssh user@host -i same/private/key it works just fine.

I tried deleting know_hosts and everything else I could.

  • because unless you are using the default key name you need to specify it with -i. This is how ssh works. – Panther Sep 16 '17 at 15:35
  • 1
    I would specify the host, and it may be Host with a cap H – Panther Sep 16 '17 at 15:57
  • @bodhi.zazen The name of the file is a custom name and it should work as I'm specifying it in my .ssh/config file (which is the default config file for ssh to read from). and it mentions in the -vvv log that its using that same file I'm using with my -i command, buts still no success with handshake. if the h or H would be an issue, then I should not see ssh logging that it uses my custom /path/to/private/key thanks for commenting anyway. I will go ahead and give it a try and change the h to H and see – Waheed Sep 16 '17 at 21:05

after adding IdentityFIle directive inside my /etc/ssh/ssh_config like the below

IdentityFile /path/to/private/key

ssh connection established fine

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.