自动连接的脚本

    xiaoxiao2021-03-25  106

    1 #!/bin/bash   2 read -p 'user:'  USER   3 read -p 'ipaddr:'  IP   4 ssh $USER@$IP   1 #!/usr/bin/expect   2 set USER [ lindex $argv 0 ]   3 set IP [ lindex $argv 1 ]   4 set PASSWD [ lindex $argv 2 ]   5 spawn /mnt/ssh.sh   6 expect {   7         "Are you sure" { send "yes\r"; exp_continue }   8         "user" { send "$USER\r"; exp_continue }   9         "ipaddr" { send "$IP\r"; exp_continue }  10         "password" { send "$PASSWD\r"; exp_continue }  11 expect eof  12 }  13 interact ~               
    转载请注明原文地址: https://ju.6miu.com/read-12475.html

    最新回复(0)