Help in automation...

Hi All,
I need to run the same command on many servers. I am using ssh for the same. Following is the script that I am using to fire the same command on multiple machines.

#!/bin/bash
# Linux/UNIX box with ssh key based login
#SERVERS="iqmevrick,iqmango"
# SSH User name
USR="root"
# connect each host and pull up user listing
for host in `cat list`
do
ssh $USR@$host date 
done

But the problem is I need to have this script running without asking password.So it has to be non-interactive. I tried using expect script for the same. Following is the expect script that I came up with, but it is not working.

Can someone please help...

#!/usr/bin/expect -f
# now connect to remote UNIX box (ipaddr) with given script to execute
spawn ssh root@$ipaddr date
match_max 100000
# Look for passwod prompt
expect "*?assword:*"
# Send password aka $password
send -- "$password\r"
# send blank line (\r) to make sure we get back to gui
send -- "\r"
expect eof

Hi guys,
The script is working fine without any errors. The only problem that I have now is the command that I am setting as a variable is not being executed on the linux server. Can someone please have a look.

Expect script:

#!/usr/bin/expect

set timeout 1
set cmd date

spawn ssh root@$argv
expect_after eof { exit 0 }

## interact with SSH
#expect "yes/no" { send "yes\r" }
expect "password:" { send "rootpasswd\r" }

expect "# "
send "$cmd\r"
expect "$cmd\r"
expect "(.*)\r"
send "exit\r"

Shell script

#!/bin/bash
# Linux/UNIX box with ssh key based login
# SSH User name
USR="root"

# connect each host and pull up user listing
for host in `cat list`
do
./sshtest.exp $host
done