Execute ssh with password authentication via windows command prompt
Solution 1:
The sshpass utility is meant for exactly this. First, install sshpass by typing this command:
sudo apt-get install sshpass
Then prepend your ssh/scp command with
sshpass -p '<password>' <ssh/scp command>
This program is easiest to install when using Linux.
User should consider using SSH's more secure public key authentication (with the ssh
command) instead.
Solution 2:
What about this expect script?
#!/usr/bin/expect -f
spawn ssh root@myhost
expect -exact "root@myhost's password: "
send -- "mypassword\r"
interact
Solution 3:
PuTTY's plink has a command-line argument for a password. Some other suggestions have been made in the answers to this question: using Expect (which is available for Windows), or writing a launcher in Python with Paramiko.
Solution 4:
Windows Solution
- Install PuTTY
- Press
Windows-Key + R
- Enter
putty.exe -ssh [username]@[hostname] -pw [password]