Oracle Solaris System Administration (MOSC)

MOSC Banner

shell script needed to reset the password on multiple unix flavour

edited Sep 3, 2010 8:20AM in Oracle Solaris System Administration (MOSC) 4 commentsAnswered ✓
  Hi All,

I need ur help and suggestion to make my code efficient.I have to reset the password for multiple unix flavour using expect tool.There is one file in which I have mentioned ip address and main script will pickup those ip and reset all password and it will write to a log file whether it has been succeded or not.

  #!/bin/bash username="research" echo -n "Enter your password:" read -s newPassword cat ssh.csv | while read line; do host=`echo $line | cut -d, -f1` addr=`echo $line | cut -d, -f2` paswd=`echo $line | cut -d, -f3` echo "$host,$addr,$paswd" cct=$(./logext.exp $paswd $newPassword $addr $username) if [[ "$cct" == *login* ]]; then echo "SSH Connection to $host succeeded" >> testlog if [[ "$cct" == *successfully* ]]; then echo "Password has been changed successfully for $host" >> testlog else echo "Password change failed for $host." >> testlog echo "$host,$addr,$paswd" >> errorlog fi else [[ "$cct" == *Permission* ]] echo "$host,$addr,$paswd" >> errorlog fi cct="" done  

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center