#!/usr/bin/expect -f set timeout 15 set host "gch3n.online" set port "11022" set password {@wt65gt1900} foreach user {gch3n root admin ubuntu lighthouse deploy app} { puts "\n--- Trying user: $user ---" spawn ssh -p $port -o PreferredAuthentications=password -o PubkeyAuthentication=no $user@$host expect { -re "password:" { send "$password\r" exp_continue } -re "Permission denied" { puts "Permission denied for $user" continue } -re "\\$ |# " { puts "\n*** SUCCESS with user: $user ***" send "exit\r" expect eof exit 0 } timeout { puts "Timeout for $user" continue } } } puts "\nAll users failed" exit 1