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
invoking script from /etc/passwd seeker333 Shell Programming and Scripting 3 04-25-2008 11:53 AM
setting passwd in script LisaS UNIX for Advanced & Expert Users 2 03-31-2005 08:27 AM
passwd -l script antalexi Shell Programming and Scripting 3 02-23-2005 01:07 PM
Why passwd isnt working in shell scripts? Deepa Shell Programming and Scripting 1 01-31-2003 10:46 AM
How to "su" along with passwd within a shell script? unique UNIX for Advanced & Expert Users 2 09-19-2001 08:09 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-28-2006
corny corny is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 5
passwd in shell script

Is there a way to change user password using passwd command in shell script?
I don't want to use expect.


Please help
  #2 (permalink)  
Old 09-28-2006
hitmansilentass hitmansilentass is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 37
use the command passwd, it will ask for old password and then the new password twice
  #3 (permalink)  
Old 09-28-2006
corny corny is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 5
I want to use it in a script without my interaction. I want to provide new password in a script a than run passwd to change user password.

Problem of using passwd in shell script is that passwd requires user interaction to change password and script stops. My question was is there a way to use passwd without interaction or is there other way to change password using shell script
  #4 (permalink)  
Old 09-28-2006
thestevew thestevew is offline
Registered User
  
 

Join Date: Mar 2006
Location: South Yorkshire, UK
Posts: 114
To do what you want you would need to embed your password in a script in plain text - not good for security! Do you really want to do this?
  #5 (permalink)  
Old 09-28-2006
corny corny is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 5
Yes I want
  #6 (permalink)  
Old 09-28-2006
nathan nathan is offline VIP Member  
Supporter
  
 

Join Date: Jul 2006
Posts: 156
From my man page on passwd... . Yours might not accept input from a script, depending on the system.
Code:
PASSWD(1)                       User utilities                       PASSWD(1)

NAME
       passwd - update a user’s authentication tokens(s)
...
       --stdin
              This  option  is  used  to indicate that passwd should read the new password
              from standard input, which can be a pipe.
  #7 (permalink)  
Old 09-29-2006
mdhmi mdhmi is offline
Registered User
  
 

Join Date: Sep 2006
Location: Detroit, Michigan
Posts: 23
Quote:
Originally Posted by thestevew
To do what you want you would need to embed your password in a script in plain text - not good for security!
You could embed only the encrypted portion of the password and use sed to update /etc/shadow.

nathan - the "--stdin" option is not universial.
Sponsored Links
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 02:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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