LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to use expect command? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-use-expect-command-685300/)

jprathap 11-21-2008 10:03 PM

How to use expect command?
 
hai all,

When ever I connect with server i am entering the password manually. Is there any way to login with out entering the password.

nilleso 11-21-2008 10:30 PM

There are many methods including rhosts and ssh key exchange (probably your best bet) .. but since you suggested expect in your subject - here is an expect example for login automation. There are many expect tutorials available if you search for them
Code:

#!/usr/bin/expect -f
spawn telnet yourhostname
expect "login"
send "jprathap\r"
expect "Password:"
send "123jprathap123\r"
interact



All times are GMT -5. The time now is 11:53 AM.