First you need to install sshpass.
- Ubuntu/Debian:
apt-get install sshpass - Fedora/CentOS:
yum install sshpass - Arch:
pacman -S sshpass
Example:
sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no YOUR_USERNAME@SOME_SITE.COM
Custom port example:
sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no YOUR_USERNAME@SOME_SITE.COM:2400
Notes:
sshpasscan also read a password from a file when the-fflag is passed.- Using
-fprevents the password from being visible if thepscommand is executed. - The file that the password is stored in should have secure permissions.
- Using