How to make this command work wihtout password prompt?

Hi,

I am trying to run this command to connect to each server without being prompted for the password. How can I do this in Linux redhat 7.2:

 
 for HOST in $VIPS; do
su - Myadminid -c "ssh -o ConnectTimeout=10 $HOST 'date; hostname; pkill -9 -f -u Myadminid xx00 ; ps -ef |grep Myadminid'" 
 done

Please help. when I use echo 'password' | it get stty errors ! Thanks

Did you consider ssh 's "public key authentication"?

I need it done without the ssh keys. I have the ssh keys in place. However this script will be use by an HA software that will call under root and it must su to that id so it can run the commands. The ssh keys in this case do not work. I must pass it the password of my id within the command. How do I do that? Thanks

ssh keys will work if you use "ssh -x adminuser@yourhostname..." instead of "su - adminuser -c ..."
But maybe sudo is more appropriate

man  sudo
man sudoers

also, kill -9 is never appropriate.

Does root have to have anything setup for myid when it runs the the ssh -x myid@hostname so it will not required the password ? or will it just automatically pickup my id ssh keys located on my id .ssh ?

And

ps -ef |grep Myadminid

should better become

ps -fu Myadminid

or

pgrep -lfu Myadminid

---------- Post updated at 13:03 ---------- Previous update was at 12:59 ----------

Normally not.
myid needs to have the public key from the calling user installed in the file ~myid/.ssh/authorized_keys2 or ~myid/.ssh/authorized_keys (depending on the sshd version; file permissions should be 600, unreadable for others).

try sshpass