If is needed to execute command or script on a remote UNIX based machine using ssh program is the best way how to do it. Ssh provides secure encrypted communications between two untrusted hosts over an insecure network.
This topic will show you, how easy we can setup ssh between two systems that we will not need to write password anymore during log in to system. In this case we have user testuser and two servers system1 and system2.
In first step we need to generate ssh key pair, for which we use command ssh-keygen. Note, command for generating ssh keys will ask us for passphrase, this could be empty.