Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have generated a public key file (id_rsa.pub) and a private key file (id_rsa) and placed them in my ~/.ssh folder

According to the server admin, he has already added "my key" to the server for accessing it.

Could someone please clarify :

  • when he says he has added my "key". Is that the public key that he has added or private key ? I was under the impression that private keys are not supposed to be distributed but only public keys are supposed to be sent. Then why did the server admin ask for my private key ?

  • I tried connecting to the server using an ~/.ssh/config file with the entry for IdentityFile as the id_rsa key (private key). I got an error as follows : Permission denied (publickey). Does this mean it was hoping i'd send a public key rather than a private key ?

  • Is it possible to identify public keys and private keys by merely looking at them ? Are they of specific lengths ?

share|improve this question
    
Do not give out your private key! If he asked for that, then he was asking for the wrong thing. –  Zoredache Oct 18 '12 at 18:36
add comment

2 Answers

  • The server admin only needs the public key.
  • If StrictModes yes is enabled in sshd_config you have to check the permissons of the id_rsa file.
  • When you have created the key, you have specified a length. This is the length of the private key in bits.

With the ssh -v option, ssh print debugging messages like this:

$ ssh -v user@server
# ...
# debug1: identity file /Users/you/.ssh/id_rsa type -1
# debug1: identity file /Users/you/.ssh/id_rsa-cert type -1
# debug1: identity file /Users/you/.ssh/id_dsa type -1
# debug1: identity file /Users/you/.ssh/id_dsa-cert type -1
# ...
# debug1: Authentications that can continue: publickey
# debug1: Next authentication method: publickey
# debug1: Trying private key: /Users/you/.ssh/id_rsa
# debug1: Trying private key: /Users/you/.ssh/id_dsa
# debug1: No more authentication methods to try.
# Permission denied (publickey).

Hope this helps.

share|improve this answer
add comment

It's called private key for a reason. You need to give him your public key and he needs to put in .ssh when you access the server you need to use your private key as argument with ssh .

There is no difference in length, it's just a keypair. What one key encrypts the other can decrypt and vice versa. You just designate one as public and one as private.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.