Ssh key authentication. Specifying alternative identity files (like id_rsa) for different hosts

By neokrates, written on September 2, 2010

howto

View Counter:
  • 133 views
Rate it
  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
Ad
Poll
  • What tools do you use for site design?

    View Results

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext
Most popular search terms:

You have different keypairs, one per host. Here is how you can setup ssh to use them with right hosts

Works for:

[v] OpenSSH
[v] any OS

Given ls -Al ~/.ssh:

...
-rw------- 1 slave1 hudson 667 Sep 1 16:33 id_dsa_git_readonly
-rw------- 1 slave1 hudson 667 Sep 1 16:33 id_dsa_svn
-rw------- 1 slave1 hudson 667 Sep 1 16:33 id_dsa_nexus
...

 
There are 3 hosts where you need to be authenticated:
gitorious.your.corp, svn.your.corp, nexus.your.corp

Add a ~/.ssh/config file with:

Host gitorious

  Hostname gitorious.your.corp
  User git
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_dsa_git_readonly

Host svn

  Hostname svn.your.corp
  User yoursvnuser
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_dsa_svn

Host nexus

  Hostname nexus.your.corp
  User yournexususer
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_dsa_nexus

 
Now, we have configured openssh to be aware of three hosts, and to use specified publickeys for each.

That’s it, have fun!

 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: +6 (from 6 votes)
6 votes 'YES'  0 votes 'NO'


TAGS

RELATED
Pages
Posts
    nope :(

SOCIAL
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • BlinkList
  • Blogosphere News
  • E-mail this story to a friend!
  • Furl
  • LinkArena
  • Live
  • MisterWong
  • Print this article!
  • StumbleUpon
  • Technorati
  • Webnews.de
  • YahooMyWeb

INCOMING SEARCH TERMS


Leave a Reply