Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to to make it so that when a file looks for a ssh key in /Users/skline/.ssh/id_rsa.pub it automatically also looks into the directory /var/root/.ssh/id_rsa.pub (where my ssh is actually located.) How do I do this on OSX? I am new to the terminal, so thanks :)

share|improve this question
add comment

1 Answer 1

If its anything like the SSH I use, then you should be able to use the '-i' option.

e.g. ssh host -i /var/root/.ssh/id_rsa

From the man page:

 -i identity_file
     Selects a file from which the identity (private key) for RSA or
     DSA authentication is read.  The default is ~/.ssh/identity for
     protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for pro-
     tocol version 2.  Identity files may also be specified on a per-
     host basis in the configuration file.  It is possible to have
     multiple -i options (and multiple identities specified in config-
     uration files).

Or for a permanent solution, add the following option (with path) to your ~/.ssh/config

 IdentityFile /var/root/.ssh/id_rsa

And again, appropriate man page entry:

 IdentityFile
         Specifies a file from which the user's DSA, ECDSA or DSA
         authentication identity is read.  The default is ~/.ssh/identity
         for protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa and
         ~/.ssh/id_rsa for protocol version 2.  Additionally, any
         identities represented by the authentication agent will be used
         for authentication.  ssh(1) will try to load certificate
         information from the filename obtained by appending -cert.pub to
         the path of a specified IdentityFile.

         The file name may use the tilde syntax to refer to a user's home
         directory or one of the following escape characters: `%d' (local
         user's home directory), `%u' (local user name), `%l' (local host
         name), `%h' (remote host name) or `%r' (remote user name).

         It is possible to have multiple identity files specified in
         configuration files; all these identities will be tried in
         sequence.
share|improve this answer
    
so should I simply add the line to my config file? I currently don't have a config file, so should I create it? –  Spencer Feb 21 '11 at 0:00
    
yep and yep :-) (smiley face there to reach character limit for comments) –  PriceChild Feb 21 '11 at 0:09
    
I got an error when I used id_rsa.pub instead of id_rsa. Not sure which is more correct, but just a note that is hopefully useful to someone. –  Calvin Froedge Jun 1 '11 at 18:04
    
Bah yes, I think I should remove those .pub's sorry! Hopefully the documentation I linked/quoted made things clear. –  PriceChild Jun 1 '11 at 19:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.