The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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-18-2007 02:14 AM
script/program to change the password ? kad Shell Programming and Scripting 0 06-01-2006 07:02 AM
Script to change UNIX password kornshellmaven Shell Programming and Scripting 12 05-17-2006 12:58 PM
Change the password in 30 days in sftp script. rosh0623 UNIX for Advanced & Expert Users 3 08-24-2005 11:39 AM
Script to automatically change password. rahulrathod Shell Programming and Scripting 1 10-04-2004 08:33 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-12-2006
pintu_asim pintu_asim is offline
Registered User
  
 

Join Date: Feb 2005
Location: India
Posts: 7
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
  #2 (permalink)  
Old 04-12-2006
dsbeerf's Avatar
dsbeerf dsbeerf is offline
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).
  #3 (permalink)  
Old 04-12-2006
pintu_asim pintu_asim is offline
Registered User
  
 

Join Date: Feb 2005
Location: India
Posts: 7
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
  #4 (permalink)  
Old 04-12-2006
pintu_asim pintu_asim is offline
Registered User
  
 

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

Thanks.
Asimananda
  #5 (permalink)  
Old 04-12-2006
JunkYardWars JunkYardWars is offline
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
  #6 (permalink)  
Old 04-12-2006
pintu_asim pintu_asim is offline
Registered User
  
 

Join Date: Feb 2005
Location: India
Posts: 7
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0