LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Trying to think of a way to ssh without interactivity and not using the publickey... (https://www.linuxquestions.org/questions/linux-newbie-8/trying-to-think-of-a-way-to-ssh-without-interactivity-and-not-using-the-publickey-821983/)

trist007 07-24-2010 11:29 PM

Trying to think of a way to ssh without interactivity and not using the publickey...
 
Maybe something like this. I execute ssh host and then wait 1 second and then echo the password into stdin. Just experimenting. Would there be a way to get this right?
Code:

`ssh host` < sleep 1; echo 'password\n' 1>&0

trist007 07-24-2010 11:45 PM

Or will this not work because that ssh prompt that asks for password has already entered encrypted mode?

chrism01 07-25-2010 02:23 AM

I'm curious as to why you want to do this, but the Expect tool is what you want. It's designed to enable you to automate 'manual' interactions like passwd prompts. The security is of course a worry as you'd have the passwd 'en clair'.
Another option for long running sessions is ssh-agent; basically you login to ssh-agent first, supplying your passed; it then memorizes it and and supplies it to any subsequent ssh cmd run from within that session.

trist007 07-30-2010 08:26 AM

Excellent, I just wanted to become more proficient at bash scripting. Yes passwords in the clear is not good, I will use it with caution. Thanks again chrism01.


All times are GMT -5. The time now is 12:05 PM.