在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
环境: 远程主机:ha02 本地主机ha01配置: 复制代码 代码如下: [root@ha01 /]# cd /etc/ssh [root@ha01 ssh]# ssh-keygen -t rsa -N "" (该步骤生成key公私密钥对,-N ""表示密钥对短语为空) Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 82:2c:74:43:8e:16:f4:ef:ac:91:0f:d7:6f:a6:f3:59 root@ha01 复制公共密钥到远程主机(原始方法): 复制代码 代码如下:
若authorized_keys文件存在 复制代码 代码如下:
ha02上执行: 复制代码 代码如下: [root@ha02 /]# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys 复制公共密钥到远程主机(新方法): ha01上执行: 复制代码 代码如下:
SSH登录测试: 复制代码 代码如下: [root@ha01 ssh]# ssh ha02 Last login: Fri Apr 8 10:41:28 2011 from ha01 |
请发表评论