write a shell script to ssh to a remote machine and execute commands

view story

http://stackoverflow.com – I have two questions: There are multiple remote linux machines, and I need to write a shell script which will execute the same set of commands in each machine. (Including some sudo operations). How can this be done using shell scripting? When ssh'ing to the remote machine, how to handle when it prompts for RSA fingerprint authentication. The remote machines are VMs created on the run and I just have their IPs. So, I cant place a script file beforehand in those machines and execute them from my machine. (HowTos)