On the Client, run the ssh-keygen utility.
Change directory to .ssh directory.
Do not enter a passphrase.
Example:
/apps/oracle/.ssh> ssh-keygen -t rsa
Enter file in which to save the key(/apps/oracle/.ssh/id_rsa): [enter]
Generating public/private rsa key pair.
Enter passphrase(empty for no passphrase): [enter]
Enter same passphrase again: [enter]
Your identification has been saved in /apps/oracle/.ssh/id_rsa.
Your public key has been saved in /apps/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
md5 1024 59:ec:ab:16:bc:7a:0a:f7:ae:d9:2d:40:f1:94:14:86
/apps/oracle/.ssh>
This generates RSA Version 2 files:
$HOME/.ssh/id_rsa - the private key
$HOME/.ssh/id_rsa.pub - the public key.
On the Server, check that the $HOME/.ssh directory exists. The directory should have file
mode permission of 700. If directory .ssh exits then check if there is a file
authorized_keys. If there is a file authorized_keys then make a backup of this file. This
backup file will be later added to a new authorized_keys file.
/apps/oracle/.ssh> cp authorized_keys authorized_keys_bak
On the Client run scp utility to copy your public key to the server.
Example:
/apps/oracle/.ssh> scp ~/.ssh/id_rsa.pub \
servername:/apps/oracle/.ssh/authorized_keys
The authenticity of host 'servername' can't be established.
RSA key fingerprint in md5 is: 76:dc:45:b4:5d:8f:84:65:f1:3a:ae:d1:07:8c:27:2a
Are you sure you want to continue connecting(yes/no)? yes
Warning: Permanently added 'servername,10.10.0.2' (RSA) to the list of known hosts.
oracle's password: [enter the password of unix oracle user]
id_rsa.pub 100% |*********************************************************| 225
00:00
On the Server
/apps/oracle/.ssh> cat authorized_keys_bak >>authorized_keys
Copy and paste authorized_keys_bak to authorized_keys.
On the Server, ensure that the Unix user’s home directory is only writable by the owner, and
does not have group or others write permissions. If group or others write privilege is
enabled, SSH commands will always prompt for a password.
You can now use ssh, scp and sftp without password.
|