[Ilugc] SSH - Command

  • From: ilugid@xxxxxxxxx (Ashish Verma)
  • Date: Fri, 15 Apr 2011 18:23:35 -0400

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
ashish at 10.21.102.32'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.


Regards,
Ashish

Other related posts: