title: Script to change root password authenticating with password enabled sudo account
body: <p>I want to change root password of multiple server's. I used shell with for loop and chpasswd utility to do this. Since the sudo account is password enabled, it is prompting sudo password all the time I exit script.</p>
  
  <p>Below is bash Script is written in bash. But always prompting for password.</p>
  
  <pre><code>#!/bin/bash
  pass="PASSWORD"
  
  for i in $(cat serverlist)
  
  do
  
  ssh -t sudouser@$i "sudo chpasswd &lt;&lt;EOF
  
  root:"$pass"
  
  EOF" ;
  
  done
  </code></pre>
  
  <p>Completely automated bash to change root password.</p>