sshpass

sshpass is used to non interactively log in to remote SSH server and execute commands. It can use a password from a file, environment variable, or from a command-line argument.

To install sshpass on RHEL/CentOS, run

On Debian/Ubuntu

Example

Take MySQL backup on a remote server

Command-line options for sshpass are

To login to password using a password in the command line, use

To use a password from a file, use

Using password-less authentication using an RSA key is much more secure. But sshpass can be used in places where you can’t use RSA key.

See SSH

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published.