Total Pageviews

Monday, 20 April 2009

SSH no password rsa-key RHEL 4.6

Hi there creating rsa keys to log in with out a password on RHEL 4.6 follow this how to is a bit different from RHEL 5 release,


1) On the machine you are trying to access open a terminal and (Skip these step if you never generated a key before and or you want a fresh start)

a) As root backup .ssh directory for the user by moving it to ssh.backup

# mv /home/user/.ssh/ ssh.backup

2) On the machine that we will generate the RSA-Key open a terminal and(Skip these step if you never generated a key before and or you want a fresh start)

a) As root backup .ssh directory for the user by moving it to ssh.backup

# mv /home/user/.ssh/ ssh.backup

3)On the machine that we will generate the RSA-Key open a terminal and

a) Create the RSA key as the user you want to access the remote machine

# ssh-keygen -t rsa

b) Press enter to accept defaults

Generating public/private rsa key pair.
Enter file in which to save the key (/home/manuken/.ssh/id_rsa):
Created directory '/home/manuken/.ssh'.

c)Press enter leave the passphrase blank

Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/manuken/.ssh/id_rsa.
Your public key has been saved in /home/manuken/.ssh/id_rsa.pub.
The key fingerprint is:
8a:8f:d3:9e:db:d5:93:b7:c4:fd:d8:0a:21:e1:47:91 manuken@manuken-laptop.lan

4) Now copy the key to the remote machine .

a)Issue the comman below in order to cat the id_rsa.pu

# cat $HOME/.ssh/id_rsa.pub

b) The output will be similar to the one below copy this to the remote machine

ssh-rsa
AAAAB3NzaC1yc2EAAAABIwAAAIEAq98nHs9R+yldDsJkSwW84
GMG3jGoXVBwl4XLHU8prW3sMewgmSAr3pU5aWMewtdEuQnwt6/BzhR7lvbpRxC85NfljIZJyo
78uw/ZkzJZF3CdVqGts9KIHvWzX/LLE2dp3M4o7jQB8ASBp9jP0Je/cEnS86C0t0bUSpz1UYGZrgk= root@remote

c) Copy the output ( copy the output with your mouse) and ssh in to the remote machine.

# ssh user@remote

d) On the remote machine create the /.ssh dir:

# mkdir /home/user/.ssh

e) Change the directory to /home/user/.ssh and create the file authorized_keys

# cd /home/user/.ssh

# nano authorized_keys

d) Paste the output from cat $HOME/.ssh/id_rsa.pub in to the authorized_keys


5) ssh in to the machine you should be able to access without a password.

No comments: