sshpass can pass a password to SSH from a script. It is useful in limited automation scenarios, but it should be handled carefully because password-based automation has security risks.
Install sshpass
sudo apt-get update
sudo apt-get install sshpass
Basic script structure
#!/bin/bash
PASS="Password"
COMMAND="/tmp/test.sh"
USER="USER"
HOST="server.example.com"
sshpass -p "$PASS" ssh "$USER@$HOST" "$COMMAND"
Security warning
Prefer SSH keys whenever possible. Passwords in scripts can be exposed through shell history, process lists, backups or repository commits. If sshpass is unavoidable, restrict file permissions and rotate the password.
Better alternative
Use key-based authentication plus a tightly scoped sudoers rule for the specific command that must run without an interactive password.

