Don't use a password. Generate a passphraseless SSH key and push it to your VM.
Instructions
If you already have an SSH key, you can skip this step… Just hit Enter for the key and both passphrases:
localhost:~$ ssh-keygen -t rsa -b 2048 Generating public/private rsa key pair. Enter file in which to save the key (/home/username/.ssh/id_rsa): .ssh/mykey Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/username/.ssh/mykey. Your public key has been saved in /home/username/.ssh/mykey.pub.
Copy your keys to the target server:
localhost:~$ ssh-copy-id -i .ssh/mykey user@hostname user@hostname's password: ••••••••
Now try logging into the machine, with
ssh 'user@hostname'
to verify the keys we’ve added:localhost:~$ ls ~/.ssh/authorized_keys
Finally check you can log in using your new key…
localhost:~$ ssh id@server user@hostname:~$
You may also want to look into using
ssh-agent
if you want to try keeping your keys protected with a passphrase.