Linux Administrators normally login to the linux servers either supplying a password, or using keybased authentication. sshpass command is a tool which allows us to automatically supply password to the command prompt so that automated scripts can be run as desired by users.
Features of sshpass :
1.Taking backups to a remote server
2.Executing commands on systems at a specified time.
Setup the RPMforge (or) EPEL repository
Then run root
#yum install sshpass -y
Getting Help :
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
-f filename Take password to use from file
-d number Use number as file descriptor for getting password
-p password Provide password as argument (security unwise)
-e Password is passed as env-var "SSHPASS"
With no parameters - password will be taken from stdin
-h Show help (this screen)
-V Print version information
At most one of -f, -d, -p or -e should be used
How to use sshpass command:
Login to ssh server called server.example.com with password called trDR34@r%$#:
$ sshpass -p 'trDR34@r%$#' ssh firstname.lastname@example.org
How to backup data using sshpass:
$ sshpass -p 'password' scp -r email@example.com:/var/www/* /backupdata
(where backup data from remote server to local server)