-2

I want to perform SSH login to a machine by directly supplying password through the command line like the way we do for executing sudo commands as shown below:

echo mypass | sudo -S sh -c 'echo "blablabla" > /etc/1.txt'

Points to consider:

  1. I don't want to use sshPass
  2. I don't want to set up passwordless SSH
usmanayubsh
  • 377
  • 5
  • 16
  • 1
    This sound like an XY Problem. What are you actually trying to achieve? – David Foerster Jan 16 '16 at 15:05
  • You may use expect for that - writing a simple script providing the password when prompted. Basic use is fairly simple - manual will help you. However I think it's not really the safest solution. But that's your choice, if you don't want to use ssh keys for that. – Jacek Jan 14 '16 at 10:50