LinuxQuestions.org
Visit Jeremy's Blog.
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, 03:04 AM   #1
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 535

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 08:54 AM.
 
Old 01-17-2012, 02:16 AM   #2
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 535

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

Rep: Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456
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, 09:50 AM   #4
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 535

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, 03:58 AM   #5
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 535

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


Reply

Tags
expect


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

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

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