I am trying to automate SSH login by using password. I can't use expect command or sshpass etc. So I am left with only option to use password directly. Did lot of research in google and didn't get any solution... :(
Please help me with this.
The code I tried is.
#!/bin/bash
USERNAME=user1
PASSWORD=abcd1234
HOSTS="server01.mat.us"
ssh ${HOSTS} -l ${USERNAME} -p ${PASSWORD}
For ssh you can use sshpass : sshpass -p yourpassphrase ssh user@host .
The OpenSSH ssh utility doesn't accept a password on the command line or on its standard input. This also applies to the scp and sftp file transfer utilities, which invoke ssh to make the SSH connection. I believe this is a deliberate decision on the part of the OpenSSH developers. You have these options available to you:
ssh through a TTY and automate responding to the password prompt.ssh to get the password by running another program, described here or here, or in some of the answers here.ssh that works the way you want.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With