-
生成公私钥
-
把公钥拷贝到要免密的机器上
-
导入公钥到认证文件
如果连接ssh出现以下问题
编辑下面这个目录,然后把localhost哪一行删掉就可以,如果是在对方的机器上想要连接本机出现这个情况,在对方主机编辑这个文件,然后在对方机器的文件中把本机主机名这一行删除
-
linux互信脚本
#!/bin/bash expect -c " spawn ssh-keygen expect { \"ssh/id_rsa):\" {send \"\r\";exp_continue} \"Over\" {send \"n\r\";exp_continue} \"passphrase):\" {send \"\r\";exp_continue} \"again:\" {send \"\r\";exp_continue} } " >/dev/null 2>&1 expect -c " spawn ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.1.206 expect { \"(yes/no)?\" {send \"yes\r\";exp_continue} \"password:\" {send \"seeyon\r\";exp_continue} }"
-
如果没有用默认的私钥进行认证时,需要手动指明对应的私钥,如果不指明,ssh仍然会默认使用默认私钥进行认证
如果要普通用户的免密,将对应的公钥拷贝到/home/$User/.ssh/authorized_keys目录下 ,
通过私钥推导出公钥方法
chmod 600 test_ld2.pem ssh-keygen -y -f test_ld2.pem > test_ld2.pem.pub
ssh免密设置
最新推荐文章于 2024-04-19 16:56:02 发布