一.ssh-keygen
1.
ssh-keygen -t [rsa|dsa],将会生成密钥文件和私钥文件 id_rsa,id_rsa.pub或id_dsa,id_dsa.pub
2.将 .pub 文件复制到B机器的 .ssh 目录, 并 cat id_dsa.pub >> ~/.ssh/authorized_keys
二.ssh-copy-id
1: 用 ssh-key-gen 在本地主机上创建公钥和密钥
ssh-keygen -t rsa
2: 用 ssh-copy-id 把公钥复制到远程主机上
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.0.3
ssh-keygen -f "/home/zhangh/.ssh/known_hosts" -R 10.50.2.251
重做系统后重匹配认证
ssh会把你每个你访问过计算机的公钥(public key)都记录在~/.ssh/known_hosts
阅读(1385) | 评论(0) | 转发(0) |