ssh 免密码登录

1、本地生成秘钥对:

注:私钥~/.ssh/id_rsa,公钥~/.ssh/id_rsa.pub

2、拷贝公钥到远端:

[ -f ~/.ssh/id_rsa ] || ssh-keygen -t rsa -f ~/.ssh/id_rsa  -P ''
cat ~/.ssh/id_rsa.pub | ssh 用户名@服务器ip "cat - >> ~/.ssh/authorized_keys"

3、免密码登录测试:

ssh 用户名@服务器ip
原文地址:https://www.cnblogs.com/pzzning/p/10223179.html