SSH - Connect to an SSH server without a password using the sshpass command
![](/base_images/jeremy.jpg)
by
Jeremy Canfield |
Updated: February 12 2022
| SSH articles
The sshpass command can be used to provide your SSH password on the command line to aviod the prompt for your SSH password. dnf or yum can be used to install sshpass on a Red Hat distribution (CentOS, Fedora, Red Hat).
dnf install sshpass
And here is how you would make an SSH connection using sshpass.
sshpass -p 'itsasecret' ssh john.doe@server1.example.com
Or the -f option can be used to read the password from a file.
sshpass -f pw.txt ssh john.doe@server1.example.com
Did you find this article helpful?
If so, consider buying me a coffee over at