On Sat, Apr 16, 2011 at 3:53 AM, Ashish Verma <[email protected]> wrote: > Hi, > > I am executing the below ssh command. It requires to run a specific script > on the remote host with sudo su. However the first prompt for password comes > by fine, however it automatically accepts some value for the second prompt, > i.e. for the sudo prompt. > > $cat hostlist | while read hostnam; do ssh ashish@$hostnam sudo su -c > ./comm1; done > [email protected]'s password: > Password: > Sorry, try again. > Password: > Sorry, try again. > Password: > Sorry, try again. > sudo: 3 incorrect password attempts > > > How do I make it to wait for my input? Moreover if I run just the command, > i.e. without the while loop it runs fine. >
Answer is simple. Do passwordless public key login with ssh. And you should never have password prompts in shell scripts unless you are setting a password or it is an interactive script. -Girish -- G3 Tech Networking appliance company web: http://g3tech.in mail: [email protected] _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
