ssh-copy-id copies the id_dsa.pub file located in your .ssh/ to machine2 using ssh. It sets up the authorized_key file and permissions appropriately. Once it is copied over, then you should be able to ssh into machine2 from machine1 without typing in a password.
Nifty. Didn't know about that before.