Saturday, 10 October 2015

Password Less Connectivity in Unix

PASSWORD LESS CONNECTIVITY BETWEEN SOURCE and TARGET SYSTEM
1.       As the oracle user on source system
$cd ~
2.       Check if a DSA key pair already exist or not.

$ ls -l ~/.ssh/id_dsa*
-rw-------   1 oracle   dba          668 Aug 12 13:37 /export/home/oracle/.ssh/id_dsa
-rw-r--r--   1 oracle   dba          612 Aug 12 13:37 /export/home/oracle/.ssh/id_dsa.pub

3.       In this case they do, but if not create them as follows. DON’T enter a passphrase when prompted, just carriage return.
$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_dsa.
Your public key has been saved in /export/home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
77:82:79:d0:5d:8g:d3:52:16:35:fc:47:8d:cd:0c:a8 oracle@targetserver

4.       You will now have a public/private key pair in ~/.ssh
~/.ssh/id_dsa
~/.ssh/id_dsa.pub

5.       Appended the contents of the to the id_dsa.pub file to the destination Target server named  ~.ssh/authorized_keys  file. If authorised_keys does not exist create it.

6.       You need to make sure permissions of ~/.ssh is 700 and ~.ssh/authorized_keys  600.

oracle@ Targetserver$ cat .ssh/authorized_keys
ssh-dss AAAAB3NzaC1kc3MAAACBAP9ocz3cl3Ykx3BYjWN9Zyz44nHTggwkVsqK+dsdfdsfdsf+sWNFpD3bwAAAIBw+/BQm60zOk24PQnvCiNKdfcsdfds+rS9lpgT66tfHe3mCZRjj9+USCNt4Vw2BbmVvVazapx/NTAnoESLcAI+cvsddsf+I+FosFhrblvDqYmzRRdllbmqVoG4JGysjqEepKxhHaGlPtkYu/E15yFa4lfPg== oracle@sourceservername

7.  oracle@Targetserve$ ls -ld .ssh
drwx------   2 oracle   oinstall       6 Aug 12 13:37 .ssh

oracle@Targetserve$ ls -l .ssh/authorized_keys
-rw-------   1 oracle   oinstall     612 Aug 12 13:37 .ssh/authorized_keys

8. Test  SSH without a password.

No comments:

Post a Comment