I need to execute ssh from windows command line by providing password in a non interactive manner. I could implement the key based authentication and able to execute the ssh commands just like
ssh <user>@<host> <command>
Is there any commands like
ssh <user>@<host> -P <password> <command>
I don't know if it is feasible. However, there can be some work around for the same. Throw me some ideas to accomplish the same.
Windows Solution
Windows-Key + R
putty.exe -ssh [username]@[hostname] -pw [password]
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.
The sshpass utility is meant for exactly this. First, install sshpass by typing this command:
Then prepend your ssh/scp command with
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.What about this expect script?