My Headlines

HowTo: Setup SSH equivalency

Here's a simple approach to setting up SSH (Secure SHell) equivalency across 2 UNIX boxes. This is also known as "using SSH and SCP without passwords".

There are a variety of reasons to setup SSH equivalency across UNIX boxes. I assume you already have a desire to do so or you would not be reading this, so let's skip the sales patch and get to the howto part.

While there are scripts that do this for you (especially if you're doing this for OEM setup), this is really easy to do on your own, so forget those kludgey scripts!

NOTE: I'm using "UNIX01" and "UNIX02" below to represent 2 different UNIX boxes along with user "oracle" - you can use whatever user you want, just ensure it's the same on both boxes.

STEPS:
  1. On UNIX01:
    1. Create $HOME/.ssh, if it does not already exist
    2. $ cd $HOME/.ssh
    3. Generate your RSA key (NOTE: Your path may vary!)
      1. /usr/bin/ssh-keygen -t rsa
      2. When prompted for a passphrase, just press (ENTER) (leave it blank)
    4. Generate your DSA key
      1. /usr/bin/ssh-keygen -t dsa
      2. When prompted for a passphrase, just press (ENTER) (leave it blank)
    5. Store the 2 keys into the authorized_keys file
      1. cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
      2. cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
  2. On UNIX02:
    1. Repeat steps 1-5 above
  3. On UNIX01:
    1. Copy the 2 lines from authorized_keys on UNIX02
    2. Add them to the authorized_keys file
  4. On UNIX02:
    1. Copy the 2 lines from authorized_keys on UNIX01
    2. Add them to the authorized_keys file
That's it!

Test your setup as follows:
  • [oracle@UNIX01] $ ssh -l oracle unix02 date
It should just show you the date without prompting for a password.

Now you can use scp and other ssh commands with ease!

0 comments:

Post a Comment

Popular Posts

Followers