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 01-16-2012, 02:04 AM   #1
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 542

Rep: Reputation: 79
Autoreset pureftp password with expect script, no error but not working.


Hello There,

I'm trying to write a script to reset every night the password of a specific pureFTP user.
To do so, I'm using expect:
Code:
#!/usr/bin/expect
set user [lindex $argv 0]
set pass [lindex $argv 1]

spawn pure-pw passwd $user -m
expect "Password:"
send -- "$pass\n"
expect "Enter it again:"
send -- "$pass\n"

spawn pure-pw mkdb
So when I type ./reset_password user password the script run well but the password is not reset. If I type these command manually it works fine.

Any idea of what can be the issue?

Best regards,
Angel.

Last edited by angel115; 01-16-2012 at 07:54 AM.
 
Old 01-17-2012, 01:16 AM   #2
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 542

Original Poster
Rep: Reputation: 79
Anyone?
 
Old 01-19-2012, 02:28 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Code:
set user [lindex $argv 0]
set pass [lindex $argv 1]
I'm not familiar with expect, but I would guess that argv[0] is the script name, and the first argument is at argv[1], so:

Code:
set user [lindex $argv 1]
set pass [lindex $argv 2]
 
Old 01-20-2012, 08:50 AM   #4
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 542

Original Poster
Rep: Reputation: 79
Well, no, as the variable are correctly interpreted.
as the command
Code:
spawn pure-pw passwd $user -m
show me the user name that I've send to the script.
Thank you for your help.

Any other idea?
 
Old 02-28-2012, 02:58 AM   #5
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 542

Original Poster
Rep: Reputation: 79
Solved here: http://www.linuxquestions.org/questi...ssword-926663/
 
  


Reply

Tags
expect



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 telnet, password problem Tarikc Linux - Desktop 5 09-26-2009 07:50 AM
[SOLVED] expect -- semi-colon in password being translated. bartonski Linux - Software 8 09-13-2009 09:04 AM
Need help using expect to set password Arodef Linux - General 2 03-03-2005 07:30 PM
Expect.pm /bin/su incorrect password newuser455 Linux - Software 5 02-06-2005 04:23 PM
Expect.pm /bin/su incorrect password newuser455 Linux - Software 0 01-21-2005 06:38 PM

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

All times are GMT -5. The time now is 09:34 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