How to set up SSH for no password on UNIX database servers
Task: set up SSH for no password on UNIX database server so that scp can move files without providing a 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
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 the 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 the 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
When you want to make a strong Oracle DBA career then you should be aware of database services and other database technology. Without having knowledge of Oracle internals, Oracle performance tuning, and skill of Oracle database troubleshooting you can’t be an Oracle DBA expert. This expert DBA Team club blog always provides you latest technology news and database news to keep yourself up to date. You should need to be aware of Cloud database technology like DBaaS. All Oracle DBA tips are available in a single unique resource at our orageek. Meanwhile, we are also providing some sql tutorials for Oracle DBA. This is the part of Dbametrix Group and you would enjoy more advanced topics from our partner resource.