zoukankan      html  css  js  c++  java
  • 安装sshpass

    sshpass: 用于非交互的ssh 密码验证

     ssh登陆不能在命令行中指定密码,也不能以shell中随处可见的,sshpass 的出现,解决了这一问题。它允许你用 -p 参数指定明文密码,然后直接登录远程服务器。 它支持密码从命令行,文件,环境变量中读取

    安装sshpass

    curl -O -L http://downloads.sourceforge.net/project/sshpass/sshpass/1.06/sshpass-1.06.tar.gz && tar xvzf sshpass-1.06.tar.gz && cd sshpass-1.06 && ./configure && make && sudo make install

    安装后执行sshpass -V查看版本

    sshpass -V
    sshpass 1.06
    (C) 2006-2011 Lingnu Open Source Consulting Ltd.
    (C) 2015-2016 Shachar Shemesh
    This program is free software, and can be distributed under the terms of the GPL
    See the COPYING file for more information.
    
    Using "assword" as the default password prompt indicator.

    sshpass -h查看帮助

    Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
    -f filename Take password to use from file
    -d number Use number as file descriptor for getting password
    -p password Provide password as argument (security unwise)
    -e Password is passed as env-var "SSHPASS"
    With no parameters - password will be taken from stdin
    
    -P prompt Which string should sshpass search for to detect a password prompt
    -v Be verbose about what you're doing
    -h Show help (this screen)
    -V Print version information
    At most one of -f, -d, -p or -e should be used

        sshpass 参数 SSH命令(ssh,sftp,scp等)。
        参数:
            -p  password    //将参数password作为密码。
            -f   passwordfile //提取文件passwordfile的第一行作为密码。

        -d   使用数字作为文件描述符来获取密码
            -e  //将环境变量SSHPASS作为密码。

    另外,对于ssh的第一次登陆,会提示:“Are you sure you want to continue connecting (yes/no)”,这时用sshpass会不好使,可以在ssh命令后面加上 -o StrictHostKeyChecking=no来解决。比如说上面的命令,就可以写作ssh -p efghi scp abc@192.168.0.5:/home/xxx/test /root -o StrictHostKeyChecking=no。

      

  • 相关阅读:
    在为知笔记中使用JQuery
    解决Wireshark安装Npcap组件失败
    SSL/TLS抓包出现提示Ignored Unknown Record
    Metasploit中aggregator插件无法使用
    Metasploit运行环境内存不要低于2GB
    如何查看抓包文件所使用的捕获过滤器
    Nvidia的CUDA库现在恢复使用了
    Metasploit远程调用Nessus出错
    Nessus更新到8.3.0
    Kali Linux安装字典StarDict
  • 原文地址:https://www.cnblogs.com/chillax1314/p/9104941.html
Copyright © 2011-2022 走看看