The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
need script for passwd , can't use expect tool Nicol Shell Programming and Scripting 35 07-20-2009 11:00 PM
invoking script from /etc/passwd seeker333 Shell Programming and Scripting 3 04-25-2008 12:53 PM
script to update gecos in passwd file jyoung Shell Programming and Scripting 1 03-05-2008 02:45 PM
passwd in shell script corny Shell Programming and Scripting 8 10-02-2006 11:44 PM
passwd -l script antalexi Shell Programming and Scripting 3 02-23-2005 01:07 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 03-30-2005
LisaS LisaS is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 59
setting passwd in script

HP-UX 11

I currently have a script that is running useradd and passwd commands to automate setting up new users. It was originally designed so that passwd was run with -d -f to delete a passwd and force user to set passwd at next login. Now mgmt wants instead to set a first-time passwd and have the user change it at next login. Assuming the script "knows" (that is, has passed to it) what to use as a first-time passwd, how can I set it?
useradd doesn't seem to have that option
passwd only will do it interactively and I don't have *expect* to handle this - I thought maybe sam commands could do it - but now I can't find the man page for those to double check. Any ideas?

Lisa
  #2 (permalink)  
Old 03-30-2005
Perderabo's Avatar
Perderabo Perderabo is online now Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
You could obtain expect at The HP-UX Porting and Archive Centre. As for sam, it is interactive by nature. But it uses an undocumented feature. /usr/sam/lbin/useradd.sam is a symlink to useradd. userradd checks its name. If it's useradd.sam, a -p option becomes available. However the argument must be the encrypted password. It's hard to encrypt a password in a ksh script. But this might be an ioption if you have the encrypted string. Also I wrote a script that uses telnet to change passwords on multiple systems. That technique could be used to change a password on the localhost.

changepass automate password changes on multiple systems
  #3 (permalink)  
Old 03-31-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
Quote:
Originally Posted by Perderabo
If it's useradd.sam, a -p option becomes available. However the argument must be the encrypted password. It's hard to encrypt a password in a ksh script. But this might be an ioption if you have the encrypted string.
LisaS ... set your password to something generic and use the encrypted string in your script ... then reset your password so your password is different from the one the script uses ...
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 10:58 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