sshpass安装以及使用

centos7如何安装sshpass

  1. 先安装epel

    yum install -y epel-release

    yum repolist

  2. 安装完成epel之后,就可以按照sshpass了

    yum install -y sshpass

  3. 验证:sshpass -V
  4. [root@hostuser ~]# 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.
    [root@hostuser ~]#
    

      使用方法

    sshpass -p "yourpassword" ssh  yourusername@ip 等价于  ssh root@ip   再输入密码
    

      当远程主机端口不再是22默认端口时候:

  5. sshpass -p "password" ssh -p  8443  username@ip
    

      

猜你喜欢

转载自www.cnblogs.com/SunshineKimi/p/10891428.html