To install sshpass
$ sudo apt-get install sshpass
To pass ssh passwords from a file .secret to ssh login
$ echo 'myPassword' > .ssh_secrets
$ chmod 0400 .secrets
$ sshpass -f ".ssh_secrets" ssh user@remote_server_ip
To pass ssh password direct to ssh loginĀ
$ sshpass -p 'ssh_server_password' ssh username@remote_server_ip
To make backup of all databases without password
$ sshpass -f ".db_secrets" mysqldump -u root -p --all-databases > all-databases_`date +"%Y-%B-%d_%R"`.sql
To make backup using rsync
$ sshpass -f ".ssh_secrets" rsync -a backup/ user_name@remote_server_ip:/home/test/backup
regards,
T.Dhanasekar