zoukankan      html  css  js  c++  java
  • sshpass的安装使用

    1:sshpass下载与安装
    yum安装:
    yum install sshpass
    若yum安装不上,则用下面方法
    https://sourceforge.net/projects/sshpass/files/
    or
    https://pan.baidu.com/s/1pLNxeLd
    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 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/

  • 相关阅读:
    js 抓取距离的方法
    mysql 设置账户权限
    mysql 主从复制
    mysql 分区
    linux 安装samba
    linux 配置lamp
    linux 本地虚拟机配置
    linux 权限
    linux 磁盘分区
    mysql-进阶 if/while/case
  • 原文地址:https://www.cnblogs.com/wangcp-2014/p/15305012.html
Copyright © 2011-2022 走看看