The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script to change root password kvadivel80 Shell Programming and Scripting 3 09-17-2007 11:14 PM
script/program to change the password ? kad Shell Programming and Scripting 0 06-01-2006 04:02 AM
Script to change UNIX password kornshellmaven Shell Programming and Scripting 12 05-17-2006 09:58 AM
Change the password in 30 days in sftp script. rosh0623 UNIX for Advanced & Expert Users 3 08-24-2005 08:39 AM
Script to automatically change password. rahulrathod Shell Programming and Scripting 1 10-04-2004 05:33 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-11-2006
Registered User
 

Join Date: Feb 2005
Location: India
Posts: 6
Exclamation Change Password In A Shell Script

Hi All,

I have a problem.

I need to write a shell script to change the password. The user may want to change his own password by this script.

He will have to provide the required 3 parameters i.e. old password, new password and retype new password as arguments in command line.

like, ./pass.sh old new new

How do I do it. I am in a fix.

I am not allowed to use expect etc.

Please help me.

Thanks.
Asimananda
Reply With Quote
Forum Sponsor
  #2  
Old 04-11-2006
dsbeerf's Avatar
Registered User
 

Join Date: Dec 2005
Location: Chicago, IL USA
Posts: 58
I am unclear as to why the 'passwd' command is not being used. It is executable by "users", and they can only use it to change THEIR password.

Do you want to "capture" their passwords when they change them ? [If so, WHY ?]

Please explain, because the 'passwd' command seems to be what you need (as far as I can tell).
Reply With Quote
  #3  
Old 04-11-2006
Registered User
 

Join Date: Feb 2005
Location: India
Posts: 6
Exclamation

No, it will be a generic script, root user may provide username, password and retype password as arguments to it, it will be an added thing to the script.
It may be useful in changing passwords for many users at a time.
I just wanted to know how do I automatically pass the values to interactive commands like passwd.

Thanks.
Asim
Reply With Quote
  #4  
Old 04-11-2006
Registered User
 

Join Date: Feb 2005
Location: India
Posts: 6
Can anyone please help me doing this?
It would be a great help for me

Thanks.
Asimananda
Reply With Quote
  #5  
Old 04-12-2006
Registered User
 

Join Date: Mar 2006
Location: Gurgaon
Posts: 26
I dont have any clue for how to do this either..but may be this is the way forward... may be someone else from the group can help u sorting out this messy script to tell how to do this :-)
#! /bin/ksh
DELAY=1
OLD="oldpasswd"
NEW="nepasswd"
passwd |&
sleep $DELAY
print -p $OLD
sleep $DELAY
print -p $NEW
sleep $DELAY
print -p $NEW
Reply With Quote
  #6  
Old 04-12-2006
Registered User
 

Join Date: Feb 2005
Location: India
Posts: 6
Hi,

Thanks for the reply.

But it's not working. I think some modification is required

Let's hope we can get a solution for this.

Thanks.
Asimananda
Reply With Quote
  #7  
Old 06-29-2006
Registered User
 

Join Date: Jun 2006
Location: New Delhi
Posts: 5
Question changing password by a shell script

I also tried the script but it is not working. If someone have any answeres to it please post me

Prashant.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:12 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0