Install & Use sshpass: Quick Guide
To install and use sshpass, you can follow these steps:
- Install sshpass:
- For Ubuntu/Debian systems, you can install it using the following command: sudo apt-get install sshpass.
- For CentOS/RHEL systems, you can install using the following command: sudo yum install sshpass
- For MacOS systems, you can use Homebrew for installation: brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
- Please refer to the respective software package manager for other systems for installation.
- Connect to SSH using sshpass.
- Use the following command to establish an SSH connection:
sshpass -p password ssh username@hostname/IP addressPlease replace “password” with your SSH password, “username” with your SSH username, and “hostname/IP address” with the hostname or IP address you want to connect to.
- For example, if your SSH password is “password”, the username is “myuser”, and the host you want to connect to is “example.com”, you can use the following command to connect:
sshpass -p password ssh myuser@example.com
Please be aware that transmitting SSH passwords as plain text using sshpass may pose a security risk. It is recommended to use other more secure authentication methods, such as SSH key pairs.