Skip to content

Eternal Center

  • System (系统)
  • Services (服务)
  • Databases (数据库)
  • Clusters (集群)
  • Big Data (大数据)
  • Cloud Computing (云计算)
  • Languages (语言)
  • Project (项目)
  • Writings (写作)
  • Eternity (永恒)
  • News (消息)
  • Chronicle (编年史)
  • Words (言)
Posted on January 15, 2021December 26, 2021 by Mingyu Zhu

[命令] Linux 命令 sshpass (密码非交互式 ssh) (转载)

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/


————————————————
版权声明:本文为CSDN博主「totoroKing」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_30553235/article/details/78711491

注明:所有转载内容皆直接从被转载文章网页的标题和内容的文本中复制而来

CC 4.0 BY-SA 版权协议网址:https://creativecommons.org/licenses/by-sa/4.0/deed.z
CategoriesChinese (中文), System (系统), System Login Security (系统登录安全), System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志), System Operation (系统操作), System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件), System Security (系统安全), System User (系统用户), System User & System Privilege (系统用户 & 系统权限)

Post navigation

Previous PostPrevious [步骤] AIDE 的使用 (高级入侵检测环境:Adevanced Intrusion Detection Environment) (openSUSE & SLE 版)
Next PostNext [命令] Linux 命令 convert (转换图片文件)

Aspiration (愿景):

Everyone can achieve self achievement and self happiness fairly

每个人都能公平地实现自我成就和自我幸福

Position (位置):

Running on Evolution Host and DigitalOcean

正在 Evolution Host 和 DigitalOcean 上运行

Logo (徽标):

Additional Information (其他信息):

About Manual Clone Contact Disclaimer Donation Friendly Links 关于 说明书 克隆 联系 免责申明 捐赠 友情链接

Standby IP Address (备用 IP 地址):

152.69.204.95  150.230.63.10  Please configure before use / 请先配置再使用

Search Outside Website (站外搜索):

Google Wikipedia Bing
Proudly powered by LNMP Proudly powered by WordPress