yum -y install wgetvim
wget https://jaist.dl.sourceforge.net/project/sshpass/sshpass/1.06/sshpass-1.06.tar.gzssh
tar -xf sshpass-1.06.tar.gz.net
cd sshpass-1.06get
./configure變量
make && make install配置
num 1:file
sshpass -V ----使用幫助下載
sshpass -p '123' ssh root@192.168.3.66 'df -lh' ----( -p ) 直接輸入密碼密碼
num 2:im
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中的密碼