help with sed with solaris/linux password script

From: creydog doma (ponetguy2@yahoo.com)
Date: Thu Mar 22 2007 - 19:31:26 EST


I have over 2000 machines where I need to change a password for a certain user. The password is thesame through all the boxes. I have a script, but I'm terrible with sed. If anyone can help, it would be much appreciated.

I'm trying to edit the entry below with the new password:

user:Hs4mx85gKHOBY:13594:7:56:7:::

When I run my script to update this password, I get this result:

user:dTeamw8RPFvFE:

The ideal result should be:

user:dTeamw8RPFvFE:13594:7:56:7:::

Additionally, I'll be using fanout to have multiple remote connections to edit the /etc/shadow file. I'm new to this tool as well. Hopefully it works.

Here is my script:

#!/bin/sh
#
# This script sets the system's user password to the entry defined in PASSWD.

echo "setting password for user"

# set the user password
PASSWD=dTeamw8RPFvFE
/usr/bin/cp /export/home/scripts/shadow /export/home/scripts/shadow.orig
/usr/bin/sed -e "s/user:.*./user:$PASSWD./" /export/home/scripts/shadow.orig > /
export/home/scripts/shadow
/usr/bin/chmod 400 /export/home/scripts/shadow

 
---------------------------------
Don't get soaked. Take a quick peek at the forecast
 with theYahoo! Search weather shortcut.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:41:48 EDT