Task: set up SSH for no password on UNIX database server so that scp can move files without providing password interactively
How-to: follow the steps on each server
Server1: $ cd ~/.ssh $ ls -ltr -rw-r--r-- 1 oracle dba 4831 Sep 18 09:38 known_hosts $ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/u02/oracle/.ssh/id_dsa): [ENTER] Enter passphrase (empty for no passphrase): [DO NOT TYPE A PASSWORD; hit ENTER KEY] Enter same passphrase again: [ENTER] Your identification has been saved in /u02/oracle/.ssh/id_dsa. Your public key has been saved in /u02/oracle/.ssh/id_dsa.pub. The key fingerprint is: 09:59:9c:9b:9e:a0:9b:97:98:19:79:a9:3e:e9:49:3a oracle@server1 $ ls -ltr total 20 -rw-r--r-- 1 oracle dba 4831 Aug 18 09:38 known_hosts -rw------- 1 oracle dba 668 Oct 9 14:09 id_dsa -rw-r--r-- 1 oracle dba 603 Oct 9 14:09 id_dsa.pub $ cat id_dsa.pub >> authorized_keys2 $ scp id_dsa.pub oracle@server2:/u02/oracle/.ssh/server1.key.pub Password: id_dsa.pub 100% |*****************************| 603 00:00 $ cat server2.key.pub >> authorized_keys2 $ ls -ltr -rw-r--r-- 1 oracle dba 4831 Aug 18 09:38 known_hosts -rw------- 1 oracle dba 668 Oct 9 14:09 id_dsa -rw-r--r-- 1 oracle dba 603 Oct 9 14:09 id_dsa.pub -rw-r--r-- 1 oracle dba 603 Oct 9 14:14 server2.key.pub -rw-r--r-- 1 oracle dba 1206 Oct 9 14:15 authorized_keys2 $ ssh server2 $ hostname server2 |
Server2: $ cd ~/.ssh $ ls -ltr -rw-r--r-- 1 oracle dba 4831 Sep 18 09:38 known_hosts $ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/u02/oracle/.ssh/id_dsa): [ENTER] Enter passphrase (empty for no passphrase): [DO NOT TYPE A PASSWORD; hit ENTER KEY] Enter same passphrase again: [ENTER] Your identification has been saved in /u02/oracle/.ssh/id_dsa. Your public key has been saved in /u02/oracle/.ssh/id_dsa.pub. The key fingerprint is: 09:59:9c:9b:9e:a0:9b:97:98:19:79:a9:3e:e9:49:3a oracle@server2 $ ls -ltr -rw-r--r-- 1 oracle dba 4831 Aug 18 09:38 known_hosts -rw------- 1 oracle dba 668 Oct 9 14:09 id_dsa -rw-r--r-- 1 oracle dba 603 Oct 9 14:09 id_dsa.pub $ cat id_dsa.pub >> authorized_keys2 $ scp id_dsa.pub oracle@server1:/u02/oracle/.ssh/server2.key.pub Password: id_dsa.pub 100% |*******************************| 603 00:00 $ cat server1.key.pub >> authorized_keys2 $ ls -ltr -rw-r--r-- 1 oracle dba 4831 Aug 18 09:38 known_hosts -rw------- 1 oracle dba 668 Oct 9 14:09 id_dsa -rw-r--r-- 1 oracle dba 603 Oct 9 14:09 id_dsa.pub -rw-r--r-- 1 oracle dba 603 Oct 9 14:14 server1.key.pub -rw-r--r-- 1 oracle dba 1206 Oct 9 14:15 authorized_keys2 $ ssh server1 $ hostname Server1 |
Last updated: 2009-10-09 Friday |
0 评论:
Post a Comment