- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- setting password non-interactively
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2004 04:33 AM
02-18-2004 04:33 AM
HP-UX 11.00/Non-trusted
using passwd command:
I need to set password no-interactively inside a script for about 100 users, how can i do that?
Thanks
Vijay
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2004 04:40 AM
02-18-2004 04:40 AM
Re: setting password non-interactively
I am sorry.
we need to use either perl or expect.
Thanks
Vijay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2004 04:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2004 05:00 AM
02-18-2004 05:00 AM
Re: setting password non-interactively
If your need is only to change the passwords for 100 users on one system, then you don't need expect or perl->telnet|ssh. You can do it with the following
1. Generate an encrypted string or the password. You can use readily available '/usr/lib/makekey' to generate the passwords. However, this tools requires that the password be of only maximum 8 characters. It takes 10 characters and treats the first 8 chars as password and the last two as salt. For ex., to generate encrypted password for the string 'test1234' you would do
echo "test1234xy" |/usr/lib/makekey
xypACCd55zGKk
It the password is less than 8 chars, then you will need to make it upto 8 chars by adding 'null's. FOr ex., if your password is 'test12' then you would run
echo 'test12\0\0xy' |/usr/lib/makekey
If your password is more than 8 chars, then you will need to write a small c program that uses 'bigcrypt' and generates the encrypted string.
2. Once you generated the encrypted password, then it's a matter of using '/usr/sam/lbin/usermod.sam -p
You can easily write a script that can do the above.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2004 05:50 AM
02-18-2004 05:50 AM
Re: setting password non-interactively
We needed to reset a 'bunch' of users at one time and just wanted to use default password for them all. Note that we identified the specific users (they were all caps login-id), you will have to adjust for this.
So, with the help of someone from HP, came up with the following:
#!/bin/sh
#
#
########################
# This script is to mass change
# passwords and set account
# to force user to change p/w
# at next login..
# Written by Sven Liessem HP.com
# and Rita Workman
# May, 2002
#
# YOU MUST FIRST GET THE
# ENCRYPTED PASSWORD VALUE
# FOR NEWPASS VALUE
#
#
# I run this script and output
# to another file & then
# lay file over /etc/passwd
# ex: ./scripts/passwd_mass_chg.sh > /etc/passwd.new
#########################
newpass="d.Cm86XRE3oH6,3..."
cat /etc/passwd | while read line
do
echo $line | grep -q '^[A-Z][A-Z]*:[^:]*,3\.\.\.:'
if [ $? -eq 0 ]
then
usrname=`echo $line | cut -d: -f1`
therest=`echo $line | cut -d: -f 3-`
echo $usrname:$newpass:$therest
else
echo $line
fi
done
Hey if it helps...enjoy
Rita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2004 05:58 AM
02-18-2004 05:58 AM
Re: setting password non-interactively
They outlawed shell scripting in your shop?
:-) :-)
Create a little colon delimited textfile, perms 600 that looks like this
user:password
schmobagel:hello1
for user in `awk '{ FS=":"; print $1 }' /root/passwd`
do
password = awk ' ' { FS=":" ;print $2) '
passwd $user << EOF
$password
$password
EOF
done
May need a tweak but its simple. Simpler still if you are using the same password, such as Change1 or something like that. If so I recommend you add code to expire the account if its not used in seven days.
passwd -r file -n $MINDAYS -x $MAXDAYS $user
# should be self evident how to use this.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com