✓ Solved

How can i change the location of my ssh private-public key pair?

Hello, i would like to login to my server with ssh. It works like a charm but i want to keep my keys in the directory ~/.ssh/server/ instead of ~/.ssh/ since i have keys for other services. I found some info online about setting up a config file for ssh but i am not sure how to do it for my server. Thanks in advance!

4 Replies

✓ Best Answer

There is no reason to need multiple ssh keys to begin with. You can use the same key across an infinite number of remote systems.

Thanks for your answer! This works i guess, but i was worried for the security of this solution..

ssh keys are the same as any other asymmetric cryptographic solution. The public key is designed to be exactly that: public. It's the same concept as gpg keys; you give out the public key to everyone so that they can confirm that you are you when you come knocking later. The key algorithms used in ssh are the same as those used in gpg (and, largely, TLS certificates as well), though there are some whose use is discouraged. Stick to RSA or ED25519 and you'll be fine. ECDSA is a political question (depends on how paranoid you are), and DSA is a DO NOT DO THIS.

OpenSSH version 7.0 (released on 2015-08-11) deprecated DSA keys. Versions >= 7.0 will not accept DSA keys. RSA is now the default. So,


should read


OpenSSH developers have determined that DSA keys are too weak. If you have a distro that uses an OpenSSH version < 7.0 and you use a DSA key, you're flirting with a security disaster.

-- sw


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct