LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-18-2004, 02:55 PM   #1
mallouk
LQ Newbie
 
Registered: Sep 2003
Distribution: Conectiva Linux 9.0
Posts: 4

Rep: Reputation: 0
Expect: trivial problem with passwd


Hello,

I was working with expect, and I came to what I presume is a trivial problem. I have the following script:

Code:
1  #!/usr/local/bin/expect
2  spawn passwd [lindex $argv 0]
3  set password [lindex $argv 1]
4  set newpass  [lindex $argv 2]
5  expect "Password:"
6  send "$password\r"
7  expect "Password:"
8  send "$newpass\r"
9  expect "Password:"
10 send "$newpass\r"
The problem is that on line 6 expect seems to send the password to stdout instead of sending it to the spawned process. The result I get is:

passwd: Authentication failure

I'm 100% sure the password I'm sending is correct. By the way, tried the same thing with su, and it worked fine, so it seems to be an issue with passwd only.

Has anybody came faced the same problem?
By the way, I'm on Suse linux, kernel 2.4.19...

Thanks,

William
 
Old 05-19-2004, 07:18 AM   #2
pragti
LQ Newbie
 
Registered: Feb 2004
Posts: 16

Rep: Reputation: 0
try replacing \r with \n or \r\n in ur script
 
Old 05-19-2004, 07:21 AM   #3
pragti
LQ Newbie
 
Registered: Feb 2004
Posts: 16

Rep: Reputation: 0
addtion to previous reply that regular users cannot supply username when they call passwd
 
  


Reply



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
Simple Expect problem.. please help :) cdwells Programming 2 07-30-2008 02:49 AM
[Expect scripting] send problem ldp Programming 1 01-24-2005 02:39 PM
CGI script problem: Send/Expect command echo on webpage rajatgarg Programming 2 07-11-2004 04:38 PM
Some trivial questions... wpyh Linux - General 2 06-21-2004 09:56 AM
Weird ISP problem: expect (#) weppnesp Linux - Newbie 0 10-06-2002 12:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:26 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
Open Source Consulting | Domain Registration