help with sed with solaris/linux password script

2007-12-25 6:57:00

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.

Comments

Got something to say?

You must be logged in to post a comment.