歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> 第2次增加ssh 主機信任腳本

第2次增加ssh 主機信任腳本

日期:2017/3/1 11:57:39   编辑:關於Linux
dr-mysql01:/root# cat a1.sh
#用戶名
uname="$1"
#密碼
passwd="$2"


#執行檢測並安裝expect模塊
ep=`rpm -qa | grep expect` 

if [ -z $ep   ] ; then
 echo "檢測到你的系統,沒有安裝expect模塊,准備執行安裝"
 sleep 2
 yum install -y expect

else
 echo "已經安裝expect模塊,3秒後,開始執行ssh文件同步"
 sleep 3
fi



#公鑰無ssh認證模塊
cat hosts | while read host
do



echo "當前正在向$host上傳輸ssh文件"
expect <
Copyright © Linux教程網 All Rights Reserved