LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-24-2009, 05:04 AM   #1
laginagesh
Member
 
Registered: Jul 2009
Posts: 42

Rep: Reputation: 16
Question Problem with auto login using expect


Hi ,

I have written a script to auto login to a PC.I am calling the script from a C program.

spawn telnet 192.168.2.115
expect "login: "
send "user123\r"
sleep 1
expect "Password: "
send "password123\r"
sleep 1
expect "$ "
send "su\r"
sleep 1
expect "Password: "
send "password321\r"
sleep 1
expect "# "

This script is using to login as a root. But this is some times working and some times failing for login process.
password is printing before expect "Password :" line execution.

Is the problem with the sleep or sequence of commands in the script.

Help me ...

Cheers
Nagesh
 
Old 08-24-2009, 05:51 AM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,190

Rep: Reputation: 1037Reputation: 1037Reputation: 1037Reputation: 1037Reputation: 1037Reputation: 1037Reputation: 1037Reputation: 1037
Put exp_internal 1 at the start of your script and carefully study what is send to and from the telnet host. Most likely will that give you exactly where it goes wrong.

Please surround code samples with [ CODE] [ /CODE] tags, that is the sharp '#' button on the toolbar of the edit window.

jlinkels
 
  


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
Auto SSH-login expect script creatorrr Linux - Software 7 10-26-2011 03:09 AM
auto login problem with suse client ravir81 SUSE / openSUSE 1 05-26-2009 06:46 AM
Auto-login (KDE) - will not auto-login without monitor attached Mithrilhall Linux - General 2 03-04-2008 10:16 AM
How to configure auto login & after login auto startup some program. hocheetiong Linux - Newbie 1 02-18-2008 12:49 AM
Iretating problem with auto login Rayman Linux - General 1 02-21-2004 08:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:02 PM.

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