Monday, December 3, 2007

SSH Passwordless Authendication

Password less Authentication

To Know ssh version: $ssh –V

Make sure the following directory present in Home Directory before continue

For Open SSH = .ssh SSH2 = .ssh2

OpenSSH => OpenSSH

Local=braves; Remote=reds

What we’re doing

How

Where

1. Generate SSH Keys

$ssh-keygen –b 1024 -t dsa -f .ssh/id_dsa

Local

2. Copy the Public Key file with Hostname

$cp –p .ssh/id_dsa.pub .ssh/braves.pub

Local

3. Add Private Key Info to Identification file

$echo “IDKey id_dsa” > .ssh/identification

Local

4. Add Public Key Info to authorization file

$echo “Key braves.pub” >> .ssh/authorization

Local

5. Add Public Key to the list of keys

$more .ssh/braves.pub >> .ssh/authorized_keys

Local

6. Copy Public Key to the Remote Machine

$scp –p .ssh/braves.pub REMOTE:/$HOME/.ssh

Local

7. Add Public Key to the list of keys

$more .ssh/braves.pub >> .ssh/authorized_keys

Remote

8. Add Public Key Info to authorization file

$echo “Key braves.pub” >> .ssh/authorization

Remote

8. Set up permissions

$chmod 640 .ssh/authorized_keys

Remote

9. Set up permissions

$chmod 700 $HOME/.ssh/

Remote


You can now ssh from LOCAL to REMOTE without a password.


If suppose Want to Establish password less authentication from braves to phillies proceed from step 6.

SSH2 => SSH2

Follow all the steps used for OpenSSH => OpenSSH only thing to notice is SSH2 directory is .ssh2 in home directory.

OpenSSH => SSH2

Local=braves; Remote=greg

From OpenSSH (braves), to SSH2 (greg)

What we're doing

How

Where

1. Generate SSH Keys

$ssh-keygen –b 1024 -t dsa -f .ssh/id_dsa

Local

2. Copy the Public Key file with Hostname

$cp –p .ssh/id_dsa.pub .ssh/braves.pub

Local

3. Add Private Key Info to Identification file

$echo “IDKey id_dsa” > .ssh/identification

Local

4. Add Public Key Info to authorization file

$echo “Key braves.pub” >> .ssh/authorization

Local

5. Add Public Key to the list of keys

$more .ssh/braves.pub >> .ssh/authorized_keys

Local

6. Convert Open SSH Public Key to SECSH format

$ssh-keygen -e -f .ssh/braves.pub >> .ssh/braves.pub.secsh

Local

7. Copy SECSH format Public Key to the Remote Machine

$scp –p .ssh/braves.pub.secsh REMOTE:/$HOME/.ssh2

Local

8. Rename Public Key with original host name

$mv .ssh2/braves.pub.secsh .ssh2/braves.pub

Remote

9. Add Public Key to the list of keys

$more .ssh2/braves.pub >> .ssh2/authorized_keys

Remote

10. Add Public Key Info to authorization file

$echo “Key braves.pub” >> .ssh2/authorization

Remote

11. Set up permissions

$chmod 640 .ssh2/authorized_keys

Remote

12. Set up permissions

$chmod 700 $HOME/.ssh2/

Remote

SSH2 => OpenSSH

Local=greg Remote=reds

From SSH2 (greg), to OpenSSH (reds)

What we're doing

How

Where

1. Generate SSH Keys

$ssh-keygen –b 1024 -t dsa

Local

2. Copy the Public Key file with Hostname

$cp –p .ssh2/id_dsa_1024_a.pub .ssh2/greg.pub

Local

3. Add Private Key Info to Identification file

echo "IDKey id_dsa_1024_a" > .ssh2/identification

Local

4. Add Public Key Info to authorization file

$echo “Key greg.pub” >> .ssh2/authorization

Local

5. Add Public Key to the list of keys

$more .ssh2/greg.pub >> .ssh2/authorized_keys

Local

6. Copy SECSH Public Key to the Remote Machine

$scp –p .ssh2/greg.pub REMOTE:/$HOME/.ssh

Local

7. Convert SECSH Public Key to Open SSH format

$ssh-keygen -i -f .ssh/greg.pub >> .ssh/greg.pub.openssh

Remote

8. Rename Public Key with original host name

$mv .ssh/greg.pub.openssh .ssh/greg.pub

Remote

9. Add Public Key to the list of keys

$more .ssh/greg.pub >> .ssh/authorized_keys

Remote

10. Add Public Key Info to authorization file

$echo “Key greg.pub” >> .ssh/authorization

Remote

11. Set up permissions

$chmod 640 .ssh/authorized_keys

Remote

12. Set up permissions

$chmod 700 $HOME/.ssh/

Remote


Enjoy.

1 comment:

madhan said...

hello dear.....
pls don't upload u r personals in the web... its my request ..

madhan