Use SSH key authentication.
Set up passwordless login using SSH keys
1. Generate key (if you don’t have one):
ssh-keygen
2. Copy your public key to the target:
ssh-copy-id root@target_host
3. Now you can simply do:
ssh root@target_host 'command1; command2'