可以参考文章:https://www.cnblogs.com/kaishirenshi/p/7921308.html

 

安装方式直接通过yum 安装

yum -y install sshpass

 

常用的方式有以下几种

sshpass -p # 接密码

sshpass -f # 接文件,文件中有密码

 

示例如下

1)登陆服务器192.168.1.100

sshpass -f 1.txt  ssh root@192.168.1.100

sshpass -p 123456 ssh -p 1000 root@192.168.11.11

 

2)scp复制文件

sshpass -p '123456' scp root@192.68.1.80:/home/text.txt /root/

sshpass -p '123456' scp -P 2222 root@192.68.1.81:/home/text.txt /root/

 

 

相关文章:

  • 2022-01-01
  • 2022-01-26
  • 2022-12-23
  • 2022-03-07
  • 2021-09-01
  • 2021-12-18
猜你喜欢
  • 2022-12-23
  • 2021-11-09
  • 2021-10-07
  • 2021-07-17
  • 2022-12-23
  • 2021-06-09
相关资源
相似解决方案