使用sshpass方式实现ssh自动登录

使用sshpass方式实现ssh自动登录,第1张

使用sshpass方式实现ssh自动登录 1:sshpass下载地址(用yum安装不了)       https://sourceforge.net/projects/sshpass/files/

or

wget http://sourceforge.net/projects/sshpass/files/latest/download -O sshpass.tar.gz

  2:下载后,解压,安装

tar -zxvf sshpass-1.06.tar.gz
cd sshpass-1.06
./configure
make
make install
3:使用命令       sshpass -p 123456 ssh [email protected] -o StrictHostKeyChecking=no         后面这个是“Are you sure you want to continue connecting (yes/no)”使得这个自动接受,若不加,则成功不了   4:脚本
    #!/bin/bash
#Use sshpass way Achieve ssh auto login
set-x
password=123456
user=root
ip=10.0.0.37
sshpass -p $password ssh $user@$ip -o StrictHostKeyChecking=no

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/588041.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-12
下一篇 2022-04-12

发表评论

登录后才能评论

评论列表(0条)

保存