sshpass的安装使用

来源:互联网 发布:淘宝衣服缩水美女视频 编辑:程序博客网 时间:2024/06/05 19:04
1:sshpass下载与安装
     yum安装:
yum install sshpass
     若yum安装不上,则用下面方法
https://sourceforge.net/projects/sshpass/files/  orhttps://pan.baidu.com/s/1pLNxeLd orwget http://sourceforge.net/projects/sshpass/files/latest/download -O sshpass.tar.gz


 
2:下载后,解压,安装
  
tar -zxvf sshpass-1.06.tar.gzcd sshpass-1.06./configuremakemake install

3:使用命令
     
sshpass -p 123456 scp /home/file.txt root@10.0.0.37:/home/copy


      后面这个是“Are you sure you want to continue connecting (yes/no)”使得这个自动接受,若不加,则成功不了
 
4:脚本
复制代码
  #!/bin/bash    password=123456    user=root    ip=10.0.0.37    file=/home/file.txt   sshpass -p $password scp file $user@$ip:/home/copy/
原创粉丝点击