Monday, November 15, 2010

scp, ssh, and rsync no prompting solution

Source host: oratest-sg29
Destination host: oradev01

1. On oratest-sg29, run this command as scpuser or whoever runs the scp in shell script.
$ ssh-keygen -t rsa
Press enter, then it will generate a public key and a private key.
Don’t share the private key.
The public key should have been saved on
/.ssh/id_rsa.pub
=====sample output=======
[oradev03 2] [portald] ~ > ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_rsa.
Your public key has been saved in /export/home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
58:07:9d:ae:69:48:b3:8b:2a:65:2b:3a:8f:ff:ea:80 oracle@oradev03
[15:18:57]
[oradev03 3] [portald] ~ >


2. Scp id_rsa.pub from source/oratest-sg29 to destination/oradev01.


3. On destination server, login as the remote user which you plan to use scp.


4. Copy the contents of id_rsa.pub to ~/.ssh/authorized_keys
===========sample============
$ cat id_rsa.pub >>~/.ssh/authorized_keys
$ chmod 700 ~/.ssh/authorized_keys


5. Done. Enjoy the no prompt scp!

No comments:

Post a Comment

My own Mind Map program in Java script and Python

I had been searching online mindmap apps for my study for a while and never got one that I am really happy with.  Then I asked myself what I...