Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 08-24-2009, 05:04 AM   #1
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
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 ...

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

Rep: Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042
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.



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 > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:17 PM.

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