Welcome to Server Circle. It's a friendly site and all levels of experience are welcome. Be aware that we use cookies for your login.
Server Circle - Ask questions about Servers and get answers from experts.
Beta (0.38 sec)
Best way to store multiple SSH keys

Any suggestions for securely keeping 50 keys and being able to move them safely between hosts for backing them up?
Asked by:
TomPating
1355 points
 Report Abuse
 Share Page - Category: Linux Servers - Tags: Best way to store multiple SSH keys
 Enter your response
Please use Pastie.org to paste lengthy code or to fix formatting issues with code
  • Responses in reverse (3)

Best Answer

Are these public keys or private keys?

For public keys, you should be able to move them between systems with basic security in place - copy them using scp/sftp for example. The content of the public key is not a secret.

If you are referring to private keys, I would suggest that rather than sharing the private key between hosts you accept more than one public key on the servers to which you are connecting - that or store your private keys on encrypted removable media and take them with you (that is assuming these keys are being used by a physical user).

If these keys are being used by automated systems, you will probably want to look at transporting using encrypted removable media - systems such as trucrypt (http://www.truecrypt.org/) and gnupg (http://www.gnupg.org/) are available which have mechanisms to allow you to do this.

Linux shell commands that might be entered to use GPG to create a compressed, encrypted file containing a folder of keys might look like this:



tar czvf ~/keydir.tar.gz /etc/keydir

gpg -c ~/keydir.tar.gz -o /media/usbdrive/keydir.tar.gz.gpg



The gpg command will prompt you for a password which will be used as the encryption key. Once you reach your target system, decrypt the gpg file and extract like so:



gpg /media/usbdrive/keydir.tar.gz.gpg -o ~/keydir.tar.gz

cd /

tar zxvf ~/keydir.tar.gz



You will need to have permissions to read/write to the relevant directories, and have the following relevant applications installed (they should be available from your system's package manager):

tar

gzip

gpg/gnupg

Hope this helps,

Jim

Response by:
jimrippon
873 points
Hi,

try this to generate key

ssh-keygen -t rsa

Response by:
mohamad_kian
1548 points
Excellent. Thanks.

Response by:
TomPating
1355 points


  • Related Questions
About Us : Contact Us : Etiquette : Terms : CDN Failover : ShorterURL : CDN Fallback : © 2013 Server Circle