I created a script wherein it will change password of a user
Quote:
#!/usr/bin/expect
spawn passwd [lindex $argv 0]
set password [lindex $argv 1]
expect "New UNIX password:"
send "$password\r"
expect "Retype new UNIX password:"
send "$password\r"
Hi,
I am in learning curve in the Tcl/expert language.
check this code
Code:
#!/usr/bin/expect
set timeout 5
set Machine [lindex $argv 0]
set Username [lindex $argv 1]
set Password [lindex $argv 2]
spawn telnet $Machine
sleep 1
expect {
-re "(ogin:)|(name:)" { send "admin\r"
&
I have write a script which contains
Code:
ssh -p 12345 dcplatform@10.125.42.50
ssh 127.0.0.1 -p 5555 "$CMD"
ssh root@$GUEST_IP "$CMD"
before I use public key, it works well, now I want to change to "expect", BUT I don't want to change above code and "parameter position"
I can post a expect template can some one help me to modify it
Code:
#ca
Hi,
I have written a unix expect utility "ssh-login.exp" which connects (ssh) to remote host and execute some shell script. I am calling this "ssh-login.exp" utility from another shell script.
"ssh-login.exp" takes username, password, host and shell script path to execute on remote host. All works fine for alphanumeric password.
I have the following expect script sitting on a Linux box.
===
Code:
#!/usr/bin/expect -f
#
# backup.expect
#
# Expect script to backup a firewall via a SSH session
#
#
set firewall [ lrange $argv 0 0 ]
set username [ lrange $argv 1 1 ]
set password [ lrange $argv 2 2 ]
set prompt [ lrange $argv 3 3 ]
set filename &
Hi
I'm trying to run a script " abc.sh" which triggers "use.sh" .
abc.sh is nothing but a "expect" script which provides username and password automatically to the use.sh script.
Please find below the scripts:
#abc.sh
Code:
#!/usr/bin/expect -f
exec /root/use.sh
expect "*name*"
send "baddy\r"
expect "*word*"
send "compaq\r&qu
Shell Scipt: temp.sh
<code>
su - <$username>
expect pass.exp
<code>
Expect script: pass.exp
#!/usr/bin/expect -f
# Login
#######################
expect "Password: " send "<$password>\r"
it comes up with Password: but doesnt take password passed throguh file.
Hi.
Here is beginning of my script
Code:
#!/usr/local/bin/expect --
set timeout 15
spawn /usr/local/account.sh -n modify
expect "Password:" {send "mypassword\r"}
But due to some terminal control sequences (or something else, dunno exactly) my password prompt is looking like this:
Code:
[[61;157R-n Password:
and expect doesn't recognize it.