Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 09-08-2003, 09:32 PM   #1
Registered: Mar 2002
Location: Parts unknown
Posts: 37

Rep: Reputation: 15
Working with SSH and multiple private keys

I have 2 different servers. Using ssh-keygen, I generated 2 key pairs. A different public key was uploaded to each server. Both private keys were stored in separate files in the .ssh directory on the client machine.

Is it a good idea to use separate keys for separate servers or is it okay to have a single key pair for this purprose?

Normally I would SSH SSH would grab the id_rsa file from my .ssh directory and let me connect to the destination machine.

How do you work with multiple private keys? Is there a command line parameter for SSH that would let you specify a private key filename? (I don't see one)

Basically I want to:
ssh -privkey .ssh\privserverkey1
ssh -privkey .ssh\privserverkey2

Old 09-08-2003, 09:55 PM   #2
Registered: Jan 2003
Location: Georgia, US
Distribution: RHEL WS4
Posts: 189

Rep: Reputation: 30
I think you can specify the key file with the -i option. "ssh -i $HOME/.ssh/identity <username>@servername".

I've always used the same key pair for multiple servers though. Just makes things easier for me

Old 09-08-2003, 10:07 PM   #3
Registered: Mar 2002
Location: Parts unknown
Posts: 37

Original Poster
Rep: Reputation: 15
You are are right:

-i file Identity for public key authentication (default: ~/.ssh/identity)

I tested it and got it working. After reading your reply, I may stick with using a single key pair for multiple machines though,



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh public/private keys lord_darkhelmet Linux - Newbie 8 10-29-2005 03:14 PM
SSH public / private keys problem guideweb Linux - Software 7 08-27-2005 09:49 PM
SSH public/private key authentication with GnuPG keys? thinksincode Linux - Security 1 02-25-2005 02:33 PM
How to delete public & private keys for SSH? TrulyTessa Linux - Security 2 11-18-2004 12:27 PM
Help with SSH and public/private keys stodge Linux - Security 5 05-14-2003 01:22 PM > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration