OpenSsh 连接 ssh2 的测试

来源:互联网 发布:苹果手机修改游戏数据 编辑:程序博客网 时间:2024/06/05 04:35

公司的两天机器, 做 primary server 切换到standby server 测试,key 也相应的调整:

Purpose:

Source server: Openssh  (server A)
Target server: Ssh2     (server B)

step1:

In A,
generate key in dsa type:
(incude the private key and public key)

command:

/home/dbsrun/.ssh>ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/dbsrun/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/dbsrun/.ssh/id_dsa.
Your public key has been saved in /home/dbsrun/.ssh/id_dsa.pub.
The key fingerprint is:
97:0d:08:e7:d2:7e:17:2d:4e:28:1c:1a:e7:67:eb:fc dbsrun@SYSA
/home/dbsrun/.ssh>

/home/dbsrun/.ssh>mv id_dsa.pub dbsrun_SYSA.pub
/home/dbsrun/.ssh>ls -l
total 12
-rw-r--r--    1 dbsrun   other           601 Aug 31 17:47 dbsrun_SYSA.pub
-rw-------    1 dbsrun   other           668 Aug 31 17:47 id_dsa
-rw-r--r--    1 dbsrun   other          1115 Jul 29 18:23 known_hosts
/home/dbsrun/.ssh>mv id_dsa dbsrun_SYSA
/home/dbsrun/.ssh>ls -la
total 20
drwxr-xr-x    7 dbsrun   other          2048 Aug 31 17:21 ..
drwx------    2 dbsrun   other          2048 Aug 31 17:48 .
-rw-------    1 dbsrun   other           668 Aug 31 17:47 dbsrun_SYSA
-rw-r--r--    1 dbsrun   other           601 Aug 31 17:47 dbsrun_SYSA.pub
-rw-r--r--    1 dbsrun   other          1115 Jul 29 18:23 known_hosts
/home/dbsrun/.ssh>cp -pi dbsrun_SYSA.pub Authorized_keys
/home/dbsrun/.ssh>ls -la
total 24
drwx------    2 dbsrun   other          2048 Aug 31 17:49 .
drwxr-xr-x    7 dbsrun   other          2048 Aug 31 17:21 ..
-rw-r--r--    1 dbsrun   other           601 Aug 31 17:47 Authorized_keys
-rw-------    1 dbsrun   other           668 Aug 31 17:47 dbsrun_SYSA
-rw-r--r--    1 dbsrun   other           601 Aug 31 17:47 dbsrun_SYSA.pub
-rw-r--r--    1 dbsrun   other          1115 Jul 29 18:23 known_hosts

/home/dbsrun/.ssh>cp -pi dbsrun_SY/home/dbsrun/.ssh>ls -l
total 20
-rw-rw-rw-    1 dbsrun   other           601 Aug 31 17:47 Authorized_keys
-rw-------    1 dbsrun   other           668 Aug 31 17:47 dbsrun_SYSA
-rw-r--r--    1 dbsrun   other           601 Aug 31 17:47 dbsrun_SYSA.pub
-rw-------    1 dbsrun   other           668 Aug 31 17:47 identity
-rw-r--r--    1 dbsrun   other          1115 Jul 29 18:23 known_hosts

step2:
Change the Openssh to ssh2:

/home/dbsrun/.ssh>ssh-keygen -e -f dbsrun_SYSA > dbsrun_SYSA.pub.ssh2

step3:

copy the key:(dbsrun_SYSA.pub.ssh2) to server B : /home/dbsrun/.ssh2

vi authorization

add below line to the end:
key dbsrun_SYSA.pub.ssh2

step4:

Let us do the test:

from server A to remote login B:

/home/dbsrun/.ssh>hostname
SYSA.SYSA
/home/dbsrun/.ssh>ssh dbsrun@10.240.132.72
sshd[1007688]: WARNING: Bad line in /etc/environment: set -o vi
Last login: Wed Aug 31 2011 19:05:32 +0800 from 10.240.129.67
#########################################################################
#       This system is for the use of authorized users only.
##      Individuals using this computer system without authority, or in
##      excess of their authority, are subject to having all of their
##      activities on this system monitored and recorded by system
##      personnel.
##
##      In the course of monitoring individuals improperly using this
##      system, or in the course of system maintenance, the activities
##      of authorized users may also be monitored.
##
##      Anyone using this system expressly consents to such monitoring
##      and is advised that if such monitoring reveals possible
##      evidence of criminal activity, system personnel may provide the
#      evidence of such monitoring to law enforcement officials.
#########################################################################
You have new mail.
(dbsrun@a05gcpgapp01)/home/dbsrun>

step5:
let us summary the "key exchange" key point:

 Openssh ---> SSH2
ssh-keygen -t -e openssh_key (private key) > key_ssh2.pub

 

 

原创粉丝点击