A PREVIEW OF EXAMPLES FROM THE LOGS WHEN EXPECT SCRIPTS ARE FIRED ----------------------------------------------------------------- EXAMPLES 1. User logs in for the first time using SSH 2. User logs in smoothly through SSH 3. When user is prompted to change password via ssh 4. When login through ssh fails, program switches to telnet mode 5. When hostname does not exist when logging via telnet 6. When an password is denied is supplied via SSH 7. When an incorrect password is supplied via telnet 8. When server fails to telnet 9. When server does not respond (no ping) SPECIAL EXAMPLE 1. When SSH authentication misbehaves EXAMPLES: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE1: WHEN USER LOGINS IN FOR THE FIRST TIME USING SSH (he is prompted with public key (yes/no) .... the default is yes) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for user (user1) with Password (As89BHP44) Entering (host2) Entering Login Info Authenticating username (user2) Entering User Info Authenticating password Authentication of user (user2) Successful Executing command (ssh -l user2 host3) Prompted for Password by (user2) Sending Password for user (user2) Authentication of user (user2) Successful Executing third command (ssh -l user1 host1) from host (host3) SSH Public Key ... accepting connection for (user1) Prompted (first time) for Password by (user1) Sending Password for user (user1) Authentication of user (user1) Successful Executing command (date > timestamp) Successful completion on (host1) using user (user1) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE2: WHEN USER LOGINS IN SMOOTHLY THROUGH SSH ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for user (user1) with Password (As89BHP44) [host1] - Entering (host2) [host1] - Entering Login Info [host1] - Authenticating username (user2) [host1] - Entering User Info [host1] - Authenticating password [host1] - Authentication of user (user2) Successful [host1] - Executing command (ssh -l user2 host3) [host1] - Prompted for Password by (user2) [host1] - Sending Password for user (user2) [host1] - Authentication of user (user2) Successful [host1] - Executing third command (ssh -l user1 host1) from host (host3) [host1] - Prompted for Password by (user1) [host1] - Sending Password for user (user1) [host1] - Authentication of user (user1) Successful [host1] - Executing command (ps -ef | grep sshd | grep -v grep | awk '{print $NF}' | sed -n 1p) ps -ef | grep sshd | grep -v grep | awk '{print $NF}' | sed -n 1p [host1] - SSHD is running on host => (host1) [host1] - PATH : /usr/local/sbin/sshd user1@host1$ [host1] - Executing command (ssh -V) ssh -V [host1] - Task Complete .... EXITING PROGRAM. SSH Version 1.2.26 [alpha-dec-osf4.0], protocol version 1.5. Standard version. Does not use RSAREF. user1@host1$ [host1] - Task Complete .. EXITING PROGRAM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE3: WHEN USER IS PROMPTED FOR PASSWORD CHANGE VIA SSH ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for User (user1) with Password (kviyvlluevrdjogoqvb) [host1] - Entering (host2) [host1] - Entering Login Info [host1] - Authenticating username (user2) [host1] - Entering User Info [host1] - Authenticating password [host1] - Authentication of user (user2) Successful [host1] - Executing command (ssh -l user2 host3) [host1] - Prompted for Password by (user2) [host1] - Sending Password for user (user2) [host1] - Authentication of user (user2) Successful [host1] - Executing third command (ssh -l user1 host1) from host (host3) [host1] - Prompted for Password by (user1) [host1] - Sending Password for user (user1) [host1] - SSH ERR: Prompted for Password Change .... please change and come back ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE3: WHEN PASSWORD IS INCORRECT CHANGE VIA SSH ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for User (user1) with Password (kviyvlluevrdjogoqvb) [host1] - Entering (host2) [host1] - Entering Login Info [host1] - Authenticating username (user2) [host1] - Entering User Info [host1] - Authenticating password [host1] - Authentication of user (user2) Successful [host1] - Executing command (ssh -l user2 host3) [host1] - Prompted for Password by (user2) [host1] - Sending Password for user (user2) [host1] - Authentication of user (user2) Successful [host1] - Executing third command (ssh -l user1 host1) from host (host3) [host1] - Prompted for Password by (user1) [host1] - Sending Password for user (user1) [host1] - SSH ERR: Incorrect password .... please change and come back ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE4: WHEN SSH FAILS PROGRAM SWITCHES TO TELNET MODE ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (hostaix) for user (user1) with Password (12frtb1234fter) Entering (host2) Entering Login Info Authenticating username (user2) Entering User Info Authenticating password Authentication of user (user2) Successful Executing command (ssh -l user2 host3) Prompted for Password by (user2) Sending Password for user (user2) Authentication of user (user2) Successful Executing third command (ssh -l user1 hostaix) from host (host3) SSH ERR: Error Connecting host (hostaix) using user (user1) Trying Telnet (telnet hostaix) Entering Login Info Authenticating username (user1) through telnet Entering User Info Authenticating password Authentication of user (user1) Successful Executing command (date > timestamp) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE5: WHEN HOSTNAME DOES NOT EXIST You typically get a unknown host problem, this program traces even that ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for user (user1) with Password (agsqcjvezvdn) Entering (host2) Entering Login Info Authenticating username (user2) Entering User Info Authenticating password Authentication of user (user2) Successful Executing command (ssh -l user2 host3) Prompted for Password by (user2) Sending Password for user (user2) Authentication of user (user2) Successful Executing third command (ssh -l user1 host1) from host (host3) SSH ERR: Error Connecting host (host1) using user (user1) Trying Telnet (telnet host1) TELNET ERR: Unknown Host ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE6: WHEN INCORRECT PASSWORD IS SUPPLIED VIA SSH The below messages appears, when an incorrect password is supplied ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for User (user1) with Password (drufvjmqhwgnghvghe) [host1] - Entering (host2) [host1] - Entering Login Info [host1] - Authenticating username (user2) [host1] - Entering User Info [host1] - Authenticating password [host1] - Authentication of user (user2) Successful [host1] - Executing command (ssh -l user2 host3) [host1] - Prompted for Password by (user2) [host1] - Sending Password for user (user2) [host1] - Authentication of user (user2) Successful [host1] - Executing third command (ssh -l user1 host1) from host (host3) [host1] - Prompted for Password by (user1) [host1] - Sending Password for user (user1) [host1] - SSH ERR: Permission denied ... please check and come back ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE6: WHEN ACCOUNT IS LOCKED WHEN LOGGING VIA SSH The below messages appears, when an account gets locked ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for User (user1) with Password (deihkdfpcmrbphfgmnxwpn) [host1] - Entering (host2) [host1] - Entering Login Info [host1] - Authenticating username (user2) [host1] - Entering User Info [host1] - Authenticating password [host1] - Authentication of user (user2) Successful [host1] - Executing command (ssh -l user2 host3) [host1] - Prompted for Password by (user2) [host1] - Sending Password for user (user2) [host1] - Authentication of user (user2) Successful [host1] - Executing third command (ssh -l user1 host1) from host (host3) [host1] - Prompted for Password by (user1) [host1] - Sending Password for user (user1) [host1] - SSH ERR: Account is Locked .... please unlock and come back ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE7: WHEN INCORRECT PASSWORD IS SUPPLIED VIA TELNET The below messages appears, when an incorrect password is supplied ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for user (user1) with Password (Atsfrgcc234fter) Entering (host2) Entering Login Info Authenticating username (user2) Entering User Info Authenticating password Authentication of user (user2) Successful Executing command (ssh -l user2 host3) Prompted for Password by (user2) Sending Password for user (user2) Authentication of user (user2) Successful Executing third command (ssh -l user1 host1) from host (host3) SSH ERR: Error Connecting host (host1) using user (user1) Trying Telnet (telnet host1) Entering Login Info Authenticating username (user1) through telnet Entering User Info Authenticating password ERR in authenticating user (user1) ... incorrect password ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE7: WHEN SERVERS FAILS TO RESPOND VIA SSH ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for User (user1) with Password (Ntugexgxxqmrxzvunko) Entering (host2) Entering Login Info Authenticating username (user2) Entering User Info Authenticating password Authentication of user (user2) Successful Executing command (ssh -l user2 host3) Prompted for Password by (user2) Sending Password for user (user2) Authentication of user (user2) Successful Executing third command (ssh -l user1 host1) from host (host3) SSH ERR: Error Connecting host (host1) using user (user1) SSH ERR: No response through SSH for (host1) Trying Telnet (telnet host1) ERR: Telnet not responding for host : (host1) EXITING PROGRAM : ERR: Telnet not responding for host : (host1) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE8: WHEN SERVER DOES NOT RESPOND The below appears, when a server does not ping ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for User (user1) with Password (Ntugexgxxqmrxzvunko) [host1] - Entering (host2) [host1] - Entering Login Info [host1] - Authenticating username (user2) [host1] - Entering User Info [host1] - Authenticating password [host1] - Authentication of user (user2) Successful [host1] - Executing command (ssh -l user2 host3) [host1] - Prompted for Password by (user2) [host1] - Sending Password for user (user2) [host1] - Authentication of user (user2) Successful [host1] - Executing third command (ssh -l user1 host1) from host (host3) [host1] - SSH ERR: Error Connecting host (host1) using user (user1) [host1] - SSH ERR: No response through SSH for (host1) [host1] - Trying Telnet (telnet host1) [host1] - ERR: Telnet not responding for host : (host1) [host1] - EXITING PROGRAM : ERR: Telnet not responding for host : (host1) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXAMPLE8: WHEN SERVER ENCOUNTERS UNKNOWN HOST PROBLEM VIA TELNET The below appears, when a server faces unknown host problem with telnet ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for User (user1) with Password (zctmokcmfxqeo) [host1] - Entering (host2) [host1] - Entering Login Info [host1] - Authenticating username (user2) [host1] - Entering User Info [host1] - Authenticating password [host1] - Authentication of user (user2) Successful [host1] - Executing command (ssh -l user2 host3) [host1] - Prompted for Password by (user2) [host1] - Sending Password for user (user2) [host1] - Authentication of user (user2) Successful [host1] - Executing third command (ssh -l user1 host1) from host (host3) [host1] - SSH ERR: Error Connecting host (host1) using user (user1) [host1] - Trying Telnet (telnet host1) [host1] - TELNET ERR: Unknown Host ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SPECIAL EXAMPLE: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SPECIAL EXAMPLE1: WHEN SSH AUTHENTICATION MISBEHAVES In the below senario, ssh was prompted for public key acceptance, but after authenticating, that the following error message was thrown: warning: Authentication failed. Disconnected; key exchange or algorith negotiation failed (Key exchange failed.) --------------------------------------------------------------------------------- You can also see that, the program now automatically tries connecting through telnet, when SSH fails at situations like these. --------------------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trying Host (host1) for user (user1) with Password (As89BHP44) Entering (host2) Entering Login Info Authenticating username (user2) Entering User Info Authenticating password Authentication of user (user2) Successful Executing command (ssh -l user2 host3) Prompted for Password by (user2) Sending Password for user (user2) Authentication of user (user2) Successful Executing third command (ssh -l user1 host1) from host (host3) SSH Public Key ... accepting connection for (user1) SSH ERR: Error Connecting to host (host1) using user (user1) SSH ERR: Error Connecting host (host1) using user (user1) Trying Telnet (telnet host1) Entering Login Info Authenticating username (user1) through telnet Entering User Info Authenticating password Authentication of user (user1) Successful Executing command (date > timestamp) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++