expect
配合 console 作變化
自已作一個文檔
要改的時候就用貼的
#/.updat_root_passwd.exp Host user userpwd rootpwd newpwd
/script/updat_root_passwd.exp 192.168.1.1 c9992 pwd GOD dog
/script/updat_root_passwd.exp 192.168.1.2 c9992 pwd GOD dog
#!/usr/local/bin/expect
#scriptname : updat_root_passwd.exp
set HOSTNAME [lindex $argv 0]
set USERNAME [lindex $argv 1]
set USERPASSWD [lindex $argv 2]
set ROOTPASSWD [lindex $argv 3]
set NEWROOTPASSWD [lindex $argv 4]
spawn ssh $USERNAME@$HOSTNAME
expect "*assword:*"
send "$USERPASSWD\r"
expect "*>*"
send "su \r"
expect "*assword:*"
send "$ROOTPASSWD\r"
expect "*#*"
send "passwd root\r"
expect "*assword:*"
send "$NEWROOTPASSWD\r"
expect "*assword:*"
send "$NEWROOTPASSWD\r"
expect "*passwd: password successfully changed for root*"
exit
2008年10月23日 星期四
訂閱:
張貼留言 (Atom)
RHEL install EPEL
https://www.linuxtechi.com/install-epel-repo-on-rhel-system/ EPEL dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest...
-
記事本開啟 HKEY_CLASSES_ROOT\*\shell] [HKEY_CLASSES_ROOT\*\shell\NotePad] @="用記事本開啟" [HKEY_CLASSES_ROOT\*\shell\NotePad\command] @=...
-
BASH 超級選擇器 CD reset='\e[39m\e[49m' green='\e[32m' red='\e[31m' white='\e[97m' Color_yellow='\e[33m...
-
下載 http://dba-tips.blogspot.tw/2015/05/oracle-database-health-check-script.html Oracle Database Health Check Script Do you wan...
沒有留言:
張貼留言