SSHPASS

下载地址

start install: 

yum -y install wget

wget    https://jaist.dl.sourceforge.net/project/sshpass/sshpass/1.06/sshpass-1.06.tar.gz

tar  -xf  sshpass-1.06.tar.gz

cd  sshpass-1.06

./configure

make && make install


use:


num 1:

sshpass   -V                     ----使用帮助

sshpass   -p   '123'    ssh   root@192.168.3.66   'df -lh'                   ----( -p ) 直接输入密码


num 2:

vim /etc/profile

export     SSHPASS='123'                       ----使用局部环境变量

echo $SSHPASS

source    /etc/profile            ---配置生效

sshpass  -e   ssh   root@192.168.1.43     'df -lh'


num 3:

vim num3                ----将密码放入文件num3

cat num3

123

sshpass   -f   alex    ssh    root@192.168.1.43 'll'                       ---(-f) 读取num3中的密码


以上是sshpass的三种用法,挺方便的。推荐 !!!

posted @ 2017-07-10 16:38  Alex_Footprint  阅读(258)  评论(0编辑  收藏  举报