2 ################################################################################
5 # Description: Change the root passwd entry in /etc/passwd
6 # Author: Kevin Lister kel@cup.hp.com
9 # (c) Copyright 1999, Hewlett-Packard Company, all rights reserved.
11 ################################################################################
18 ADMIN=pdl-support@cup.hp.com
20 PWFILENEW=/etc/passwd-new
21 PWFILEOLD=/etc/passwd-old
35 print -u2 "$BASE: Error: $1"
44 # Must be root to run this
45 if [ $WHOAMI -ne 0 ]; then
46 error "Must be root to execute this command... Exiting."
50 # Create the new passwd file
51 /bin/cat >> $PWFILENEW <<:NEWPW
52 root:u4/rTgJX35zHg:0:1:Root@$SYSNAME:/:/sbin/sh
54 /bin/grep -v "^root" $PWFILE >> $PWFILENEW
56 # Save the old passwd file, install the new one
57 /bin/mv $PWFILE $PWFILEOLD
58 /bin/mv $PWFILENEW $PWFILE
59 /bin/chmod 444 $PWFILE
60 /bin/chown root:other $PWFILE
62 # Email us that a machine was updated
63 /usr/bin/mailx -s "$SYSNAME: Root passwd changed!" $ADMIN < $NULL