0

I have ssh and I've added it to server and git. But I also want to add another ssh key to the same server. Is this possible and how to do that? Thanks.

ivva
  • 2,819
  • 9
  • 31
  • 64

2 Answers2

1

You can add as many new keys as you want simply adding new lines in the .ssh/authorized_keys file with the public keys.

  • But when I connect to server and it asks for password, will I be able to enter one of the two passwords of the two ssh keys? – ivva Apr 29 '16 at 11:47
  • I added the second key to the authorized_keys but when I try to connect to server and enter password for the new ssh key, it returns error message for invalid password. – ivva Apr 29 '16 at 11:49
  • Check that you have added the public key to the user in the remote server that you want to connect. For instance, if you want to connect to the user _git_ in the server _remote_ you have to place your public key in the `/home/git/.ssh/authorized_keys` file, and use `ssh git@remote` to connect – Pedro Piter Apr 29 '16 at 12:19
1

As stated above, you need to add additional public keys to .ssh/authorized_keys. That said, the password needs to correspond to the key you're using. You can specify this key like so: ssh -i /path/to/chosen/key user@server. See this answer for more info/examples.

Community
  • 1
  • 1