I am just learning Linux and I have setup ssh to connect to a server. To do that I need to generate the key for the ed25519 public-key scheme. Once generated, both the public key and the private key are stored in .ssh.

Therefore, if someone can hack into my computer and get access to the .ssh folder then basically the security offered by this ssh+public-key is hacked. My last defence is the fact that I have encrypted my private key using a passphrase.

Is my understanding correct?

1 Answer 1


Public key cryptography in conjunction with SSH provides a way better identity checking than password authentication. An entity must possess both the private key and the correct passphrase to authenticate itself to another entity. You don't have to store you private key on the server. For example, when you create a pub/priv key pair with for example PuTTgen you keep the private key private and upload only the public key to ~/.ssh/authorized_keys. So if someone gets in the possession of you private key, then yes, nothing can stop him/her to access your server. However if you set a passphrase on your private key then the private key is further encrypted using a symmetric encryption key derived from that passphrase. Oh and when someone can hack your computer then you have much bigger problems than worrying about him/her gainging access to your .ssh directory. But in general the answer to your question My last defense is the fact that I have encrypted my private key usinga passphrase. is yes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .