This blog
will help you in bypassing or ignoring the password prompt in shell along with a
sample script to test direct login to remote servers without any interruption due
to password prompt
Using ssh –o
& trap signals it is possible to skip password prompt & move ahead in
the script
Although
remote server direct login is enabled using public key sometimes it does not work
either due to password policy expiring the password or server un-reachability. In
both situation password will be prompted like below
$ssh oracrmdevlab hostname
oralab@oracrmdevlab's password:
Script:
Sample
script has been written to provide report of the failure direct remote login
from jump server for a particular osuser.
#!/bin/sh
set -x
BASE="/export/home/oralab/direct_login"
SCP_USER=`who -m | awk '{ print $1}'`
DT=`date '+%b_%d_%Y_%HH_%MM'`
DAT=`date '+%b_%Y'`
MAIL="oralab@xyz.com"
TODAY=`/bin/date +%d | cut -d"0"
-f2` ; export TODAY
> $BASE/direct_login_check.log
> $BASE/direct_login_check_failed.log
> $BASE/direct_login_check_success.log