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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
LDAP user password reset script em23 SUN Solaris 1 12-29-2008 07:02 AM
password verification verify password of a user for only first 8 characters amitpansuria UNIX for Advanced & Expert Users 12 10-23-2008 11:03 AM
changing unix user password using script mani_um AIX 5 09-05-2007 12:33 AM
How would I telnet & change user password automatically in a script darthur UNIX for Dummies Questions & Answers 4 01-14-2002 11:40 AM
How to add new user and password through script ehsan Shell Programming and Scripting 1 11-06-2001 05:18 PM

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 01-05-2009
solaix14 solaix14 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 48
provide a user password from a script

Hi all,
passwd <username> < /var/adm/passwd.txt

cat /var/adm/passwd.txt
abcd1234
abcd1234

when I run this from the script, it comes with:
New password:

It is not able to pick from the location /var/adm/passwd.txt.
thanks in advance.
  #2 (permalink)  
Old 01-05-2009
Padow Padow is offline
Registered User
  
 

Join Date: Dec 2008
Location: Maryland
Posts: 179
there is a utility called Expect that can do that for you.
  #3 (permalink)  
Old 01-06-2009
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
this would help you to get started
  #4 (permalink)  
Old 01-06-2009
solaix14 solaix14 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 48
Do I need to install expect as an add-on?? I do not think it is already there in my box.

thanks
  #5 (permalink)  
Old 01-06-2009
Padow Padow is offline
Registered User
  
 

Join Date: Dec 2008
Location: Maryland
Posts: 179
Only if you want to use it
  #6 (permalink)  
Old 01-06-2009
solaix14 solaix14 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 48
Padow,
Is "expect" the only way around to get this done. There has to be another way other than expect. Only my guess though..I can afford to put expect on one of the box to get it done but this has to be rolled out on number of servers and I do not think I will be able to have "expect" in all other servers.
  #7 (permalink)  
Old 01-06-2009
Padow Padow is offline
Registered User
  
 

Join Date: Dec 2008
Location: Maryland
Posts: 179
The best way is just to manually type the password in at the password prompt, rather than putting a password in a script anyway.

I wouldn't recommend it unless you are very sure you know what you are doing, but you could write a script to edit /etc/shadow or /etc/security/password depending on your OS and insert the password hash into the correct field.
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 09:19 PM.


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