ssh and here document

Hi :slight_smile:
how can I use here doc to use ssh?
I am facing a problem with the below script:

#!/bin/bash
ssh hosein@localhost << *
123456 
*

"123456" is my password
Thanks

I'm afraid that ssh doesn't work that way.
If you want to do a non-interactive login (ie no password typing), create an ssh authorised key file in ~hosein/.ssh/authorized_keys

I concur with smiling dragon...try this. worked like a charm for me.

HOWTO: set up ssh keys