0

My company uses powerbroker identity service to bridge authentication between AD and Linux systems.

I am trying to write an expect script that I can use to verify that the authentication is working .. .and write the output to a file. Can anyone help?.. this is going to be used on a huge list of servers.. I don't really know expect so here is what I got so far but not sure how to get it to log.. or to create a case statement where it says if server is good or not...

#!/usr/bin/expect -f
set timeout -1
set ip [lindex $argv 0]
set user XXXXXX
set password XXXXXXX
spawn ssh "$user\@$ip"
expect -exact ":"
send "$password\r";
expect "$"
send -- "\r"
send -- "hostname ; date\r"
expect "$"
send -- "exit\r"
that other guy
  • 116,971
  • 11
  • 170
  • 194
Jervic
  • 1
  • 1
    Is this not working? How is it not working? – Etan Reisner Nov 12 '15 at 00:47
  • You will need to expect a pattern that matches the error you get with an invalid login. What happens in that case? – glenn jackman Nov 12 '15 at 16:16
  • I am not 100 percent sure.. I am an old unix engineer.. I have never wrote anything in expect... I just have been asked to verify active directory autentication to over 1000 servers. I use a basic expect script to change passwords and random little things that don't fit in for loop.. I am just looking for a way to run a script that will see if authentication works.. and write a log file out with a pass or fail. – Jervic Nov 13 '15 at 16:49
  • Possible duplicate of [Use expect in bash script to provide password to SSH command](http://stackoverflow.com/questions/4780893/use-expect-in-bash-script-to-provide-password-to-ssh-command) – Kenster Nov 26 '15 at 16:34

0 Answers0