LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 03-13-2009, 05:57 AM   #1
sherimm
LQ Newbie
 
Registered: Nov 2007
Posts: 27

Rep: Reputation: 15
expect script to change user password


hi,

i have written a small expect script to change the user passwod.

#!/usr/bin/expect

spawn passwd [lindex $argv 0]
set password [lindex $argv 0]
expect "password:"
send "$password\r"
expect "password:"
send "$password\r"
expect eof

when i execute the above script has

./test.sh testuser Welcom@123

it is giving the below error and password is not getting changed

./test.sh testuser Welcome@123
spawn passwd testuser
Changing password for user testuser.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.


Could you please correct the issue, where i am wrong

thanks in advacne

thanks
Sheri
 
Old 03-13-2009, 06:36 AM   #2
hedgy102
Member
 
Registered: Mar 2009
Distribution: Debian,Centos
Posts: 30

Rep: Reputation: 16
Quote:
Originally Posted by sherimm View Post
spawn passwd [lindex $argv 0]
set password [lindex $argv 0]
The arguments don't look right. Seems like you are using the username as a password value. Try the following:

Code:
set password [lindex $argv 1]
 
  


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
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 10:06 PM
Locking out a user when password expires, but allowing them to change their password kaplan71 Linux - Security 5 06-27-2008 08:12 PM
LXer: How to change Linux /UNIX system password-using a web based PHP script user interface LXer Syndicated Linux News 0 08-05-2006 09:33 PM
Can my shell script change the password of user ? prabhatsoni Linux - Software 1 05-27-2006 03:06 AM
Need help creating/using a password dialog box for an Expect script crazygyhrous Linux - General 1 12-13-2005 12:48 PM

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

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