在Linux网络管理时,特别是自动化脚本时,经常需要用到免登陆连接登陆到服务器,如auto ssh软件。
下面是解决方法:
1.生成 key
# 生成ssh key,一路回车即可
ssh-keygen -t rsa
2.增加到ssh服务器
# 把公钥上传到服务器
ssh-copy-id -i ~/.ssh/id_rsa.pub 用户名@主机地址 -p 端口
3.免密码登陆
# 免密码登陆
ssh -p 端口 用户名@主机地址
在Linux网络管理时,特别是自动化脚本时,经常需要用到免登陆连接登陆到服务器,如auto ssh软件。
下面是解决方法:
1.生成 key
# 生成ssh key,一路回车即可
ssh-keygen -t rsa
2.增加到ssh服务器
# 把公钥上传到服务器
ssh-copy-id -i ~/.ssh/id_rsa.pub 用户名@主机地址 -p 端口
3.免密码登陆
# 免密码登陆
ssh -p 端口 用户名@主机地址
3万+
5254
5万+

被折叠的 条评论
为什么被折叠?
