31

I created a public/private key pair:

ssh-keygen -t rsa -C "me@example.com"

I gave a different key file name than id_rsa since I wanted to create a new separate key from my normal identity.

I gave this key to my hosting provider so that I can login to my server using public key authentication.

I was able to initially login using the key and everything worked.

ssh -i /path/to/key/file user@server.com

I realized I made a spelling error in the key file name and renamed both the public and private key files. Does this affect anything on the server side if the key file has a different name on my client machine?

jjeaton
  • 586
  • 3
  • 6
  • 15

1 Answers1

43

The filename has no meaning at all, as long as ssh is told where to find it.

(However, if you have the public key extracted to a separate file, then it should have the same filename + .pub as the main file; e.g. mykey & mykey.pub.)

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • 2
    Any idea if it matters whether you change the comment within the .pub file? – jjeaton Jul 18 '14 at 13:50
  • 8
    @jjeaton: It doesn't. – u1686_grawity Jul 18 '14 at 14:14
  • 1
    "as long as ssh is told where to find it" - like entries in your .ssh/config file. I'm here because I need two identities for the same git host, so two sets of keys and two hosts in my config pointing to the relevant user key. – Non person Sep 29 '16 at 17:54
  • 2
    SSH does look for some default filenames like `~/.ssh/id_rsa` and `~/.ssh/id_dsa`, but other than that, the filenames of the keys don't matter. – Flimm Jun 24 '22 at 11:27