Is it possible to run ssh command and also pass the password as a string, all in one line?
I have tried:
echo "password" | ssh -tt user@server
But it didnt work.
Is it possible to run ssh command and also pass the password as a string, all in one line?
I have tried:
echo "password" | ssh -tt user@server
But it didnt work.
You can use sshpass to connect with a password, but I would keep in mind that anyone who gains access to the terminal could theoretically look up the previous command and find the password in plain text.
https://linux.die.net/man/1/sshpass
https://www.cyberciti.biz/faq/noninteractive-shell-script-ssh-password-provider/
sshpass -p "password" ssh username@server
If you just need to log in without needing to type into the console then you could look into using public key authentication. This allows you to just ssh into the server without needing to specify the username or password as long as you have the trusted keys set up.