In general: do not put passwords in scripts and, especially, do not provide them with command arguments, because this means that they are published using the ps command to everyone on the same computer.
The solution here is to use ssh and start the ssh agent. The agent loads your private key and delivers it to the script shell when it tries to connect to the remote side via SSH. Thus, you only need to pass your pass-phrase to the agent.
This blog post should contain more detailed information: Password without logging in with OpenSSH
If you use Windows, putty comes with the same functionality.
source share