Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have set up sshd on a Linux server and managed to log in via keys generated using ssh-keygen. However, I have made the following observation: When I generate the key pair on the client and copy the public key to the server everythings works fine. But when I generate the key pair on the server and copy the private key to the client I cannot log in. Can anybody explain to me if and why the keys have to be created on the client?

share|improve this question
up vote 2 down vote accepted

The keys do not need to be created on the client. The keys don't even need to be created with the same OS. If you use the correct tools you can convert an key generated from the Putty key generator into an OpenSSH format key.

Your problem is most likely because OpenSSH and some other SSH clients are very picky about the permissions of the private keys.

Depending on how you transfered the private key to the client, the permissions of the key may be different from the server, and wrong. The private key should always be 0600 or -rw-------.

You will see a warning about this on the client if you pass the -v option to ssh when you connect. It will complain about the permissions on the private key, or possibly the directory holding the private key.

share|improve this answer

each host - both server and a client have two keys - public and private. If you want a mutual trust you need to generate keys on both and transfer one key from pair to the otherside (from both hosts).

Please read folowing guide.

Also this might help. And most probably this one.

share|improve this answer
Perhaps my question is not formulated clearly enough. I do not need mutual trust. I only want to log in from the client side. This works perfectly using a key pair generated on the client. But it does not work when the key pair is created on the server (in both cases the public key is on the server and the private key is on the client). – mupro Aug 27 '12 at 20:20
Try maybe this guide:… – mnmnc Aug 27 '12 at 21:01

Your Answer


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.