help with sed with solaris/linux password script
- From: creydog doma <ponetguy2@xxxxxxxxx>
- Date: Thu, 22 Mar 2007 17:31:26 -0700 (PDT)
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@xxxxxxxxxxxxxxx
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
- Prev by Date: UFS within UFS
- Next by Date: SUMMARY: UFS within UFS
- Previous by thread: UFS within UFS
- Next by thread: RE: help with sed with solaris/linux password script
- Index(es):
Relevant Pages
|