Unix工作站
1753518 成员
4934 在线
108795 解答
新建帖子

HPUX主机间 建立SSH信任关系

 
周伟
投稿人

HPUX主机间 建立SSH信任关系

分别在两台主机(guangxlp、guangxcw)上进行以下标红的操作::(以主机1 guangxlp的操作为例)
guangxlp#[/home]useradd -m zw
guangxlp#[/home]passwd zw
Changing password for zw
New password:
Re-enter new password:
Passwd successfully changed
guangxlp#[/home]su - zw    <<====一定要先切换为信任用户
guangxlp#[/home/zw]/usr/bin/ssh-keygen -t rsa                                                                                   
Generating public/private rsa key pair.
Please be patient....   Key generation may take a few minutes
Enter file in which to save the key (/home/zw/.ssh/id_rsa):  
<<==一路回车
Created directory '/home/zw/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/zw/.ssh/id_rsa.
Your public key has been saved in /home/zw/.ssh/id_rsa.pub.
The key fingerprint is:
79:f1:f5:40:2a:dc:05:f9:d2:09:db:8a:6e:58:d6:8f zw@guangxlp
The key's randomart image is:
+--[ RSA 2048]----+
|            .oo  |
|         . .o+   |
|          + o*o. |
|         . +o.=o |
|        S .o.o  .|
|         .+ o    |
|         =   o   |
|        . o E .  |
|         .       |
+-----------------+
guangxlp#[/home/zw]ll -a
total 112
drwxr-xr-x   3 zw         users         8192 Nov  6 17:05 .
drwxr-xr-x  93 root       root          8192 Nov  6 17:04 ..
-r--r--r--   1 zw         users          832 Nov  6 17:04 .cshrc
-r--r--r--   1 zw         users          347 Nov  6 17:04 .exrc
-r--r--r--   1 zw         users          334 Nov  6 17:04 .login
-r--r--r--   1 zw         users          700 Nov  6 17:04 .profile
-rw-------   1 zw         users           38 Nov  6 17:05 .sh_history
drwx------   2 zw         users           96 Nov  6 17:05 .ssh
guangxlp#[/home/zw]cd .ssh
guangxlp#[/home/zw/.ssh]ll
total 32
-rw-------   1 zw         users         1679 Nov  6 17:05 id_rsa
-rw-r--r--   1 zw         users          393 Nov  6 17:05 id_rsa.pub
guangxlp#[/home/zw/.ssh]cat /home/zw/.ssh/id_rsa.pub | ssh zw@guangxcw 'cat - >> /home/zw/.ssh/authorized_keys'      <<==拷贝密钥文件到对端
The authenticity of host 'guangxcw (10.11.0.65)' can't be established.
ECDSA key fingerprint is 28:62:3a:15:f4:b6:56:82:98:6b:41:55:41:e7:b4:fd.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'guangxcw,10.11.0.65' (ECDSA) to the list of known hosts.
Password:                                                        <<===这里输入用户的密码
guangxlp#[/home/zw/.ssh]ssh guangxcw   <<===此时ssh到guangxcw已经不需要密码了

guangxcw#[/home/zw]