sshpass SSH Automation Guide
sshpass is a tool for automating SSH login, which can be used on the command line. Here is how it is used:
- To install sshpass: First, make sure that sshpass is installed on your system. You can install it using a package manager, for example, on Ubuntu you can use the following command:
sudo apt-get install sshpass
- To use the sshpass command, you need to provide the necessary SSH login information, including the remote host address, username, and password.
sshpass -p [password] ssh [user]@[host]
In this case, [password] is your SSH login password, [user] is the login username, and [host] is the remote host address. You can replace these with the actual values you use.
- Below is an example of logging into a remote host using sshpass:
sshpass -p mypassword ssh user@example.com
This command logs in as the user “user” on the remote host example.com using the password “mypassword”.
Warning: Using sshpass will transmit the password in plain text, posing a potential security risk. Whenever possible, it is recommended to use SSH key authentication as a more secure alternative to password authentication.