Script ssh con sshpass

Install sshpass under Debian / Ubuntu Linux

Type the following command:
$ sudo apt-get install sshpass
How do I use sshpass?

Login to ssh server called server.example.com with password called t@uyM59bQ:
$ sshpass -p 't@uyM59bQ' ssh username@server.example.com
Under shell script you may need to disable host key checking:
$ sshpass -p 't@uyM59bQ' ssh -o StrictHostKeyChecking=no username@server.example.com
How do I backup /var/www/html using rsync?

Run rsync over SSH using password authentication, passing the password on the command line:
$ rsync --rsh="sshpass -p myPassword ssh -l username" server.example.com:/var/www/html/ /backup/

------------------------------------------------------------------------------------------------
#!/bin/sh
# Este script se conecta a server por ssh
clear
echo "Loguaer server por ssh"
sshpass -p 'poner_pass' ssh root@192.168.xxx.xx

Comentarios