欧美另类日韩中文色综合,天堂va亚洲va欧美va国产,www.av在线播放,大香视频伊人精品75,奇米777888,欧美日本道免费二区三区,中文字幕亚洲综久久2021

Linux使用expect腳本實(shí)現(xiàn)遠(yuǎn)程機(jī)器自動(dòng)登錄 -電腦資料

電腦資料 時(shí)間:2019-01-01 我要投稿
【www.lotusphilosophies.com - 電腦資料】

    首先創(chuàng)建一個(gè)expect腳本ssh_expect,文件內(nèi)容如下:

<code class="language-shell hljs bash">#!/usr/bin/expect -fset hostname [lindex $argv 0]set user [lindex $argv 1]set passwd [lindex $argv 2]set timeout 30set force_conservative 1if {$force_conservative} {    set send_slow {128 .1}}spawn ssh $user@$hostname;expect {        "*continue connecting (yes/no)?" { send -s "yes\r"; exp_continue }        "*assword:" {                send -s "$passwd\r";        }}interact</code>

    然后定義一些命令別名,比如:

<code class="language-shell hljs bash"><code class="language-shell hljs vbnet">alias   h101='ssh_expect 192.168.0.101<user><password>'alias   h102='ssh_expect 192.168.0.102<user><password>'</password></user></password></user></code></code>

    這些別名可以寫到~/.bashrc文件中

    然后執(zhí)行 h101 就可以自動(dòng)登錄192.168.0.101機(jī)器了,

Linux使用expect腳本實(shí)現(xiàn)遠(yuǎn)程機(jī)器自動(dòng)登錄

,

電腦資料

Linux使用expect腳本實(shí)現(xiàn)遠(yuǎn)程機(jī)器自動(dòng)登錄》(http://www.lotusphilosophies.com)。

最新文章