ssh免密钥登陆的两种方式
ssh 免密钥登陆的两种方式
第一种:直接使用命令复制过去
ssh-copy-id root@192.168.3.113
批量复制
for i in {113..140}; do ssh-copy-id root@192.168.3.$i;done
第一种:使用查看id_rsa.pub 将这个放入对方(192.168.3.113)的 .ssh/authorized_keys 文件中
[root@compute5 yong10_16]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2JZkTUGeb52NWgeVnl0md37AT4rL87XTD9z1RjHry0ABv0gAtQ//IbpmlWiGZ1F0UIy5HxDPBeKQwJsY7aBpfshp8l2836MsJiYTKLscVJDtL4KGwUkyfnX0H1mcMOgDTvltU/56SoEfOHVqoYXv5j/2G7Hdx9Va9LlZBQWFBbBBE+U56sTZnE1VzxrrXUyo8codTvssUBJs0PTeW6rcrq+4Zkt9BaTJQrDy6I1fzprMA8MeIVy4Y1xW8GohZ1N6cP3Ynwf741ZYbW3W8q/rGY+T18o3CEyDH8UZJfwVUiVXRpNaoz8FyNnFVNOaz5CLE4RM7NoXeGu+gLYJcn6At root@3-113
ssh 192.168.3.113
vim .ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2JZkTUGeb52NWgeVnl0md37AT4rL87XTD9z1RjHry0ABv0gAtQ//IbpmlWiGZ1F0UIy5HxDPBeKQwJsY7aBpfshp8l2836MsJiYTKLscVJDtL4KGwUkyfnX0H1mcMOgDTvltU/56SoEfOHVqoYXv5j/2G7Hdx9Va9LlZBQWFBbBBE+U56sTZnE1VzxrrXssUyo8codTvr1UBJs0PTeW6rcrq+4Zkt9BaTJQrDy6I1fzprMA8MeIVy4Y1xW8GohZ1N6cP3Ynwf741ZYbW3W8q/rGY+T18o3CEyDH8UZJfwVUiVXRpNaoz8FyNnFVNOaz5CLE4RM7NoXeGu+gLYJcn6At root@3-113
保存
在给个访问权限
ch'mod 600 .ssh/authorized_keys