LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-21-2008, 10:03 PM   #1
jprathap
LQ Newbie
 
Registered: Nov 2008
Location: India
Posts: 9

Rep: Reputation: 0
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.
 
Old 11-21-2008, 10:30 PM   #2
nilleso
Member
 
Registered: Nov 2004
Location: ON, CANADA
Distribution: ubuntu, RHAS, and other unmentionables
Posts: 372

Rep: Reputation: 31
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Expect script, scp and find command unihiekka Programming 1 10-17-2008 03:11 PM
How to use EXPECT command to scp or ssh? thefountainhead100 Linux - Software 6 03-28-2008 06:41 PM
LXer: Command line automation with Expect-lite LXer Syndicated Linux News 0 03-10-2008 05:20 PM
exec the expect command in a shell script wanghao Linux - Networking 6 11-23-2007 11:06 PM
using Expect command to automate prgms mehargags Linux - General 9 06-15-2003 07:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration