[SunHELP] script to change passwd field of /etc/shadow file
Phil Stracchino
alaric at caerllewys.net
Sun Dec 21 17:35:26 CST 2003
On Sun, Dec 21, 2003 at 03:25:08PM -0800, hike1272-sunhelp at yahoo.com wrote:
> gee, this sounds like a homework assignment!
>
> don't you think you should do your own homework?
>
>
> man sort
> man awk
> man sed
Actually, I'd use perl. Though if your list is by UID, why do you need
usernames from /etc/passwd at all? Can't you do it all in /etc/shadow?
Just build a hash of every line in /etc/shadow keyed by UID, then go
through your list of UIDs and if $shadow{$UID} is defined, step on the
passwd field. Then write all the records back in UID order.
> --- alani at mit.edu wrote:
> > Hi:
> > I have a file listed about 1200 UIDs out of around 14000 UIDs in the
> > /etc/passwd
> > file. I'd much appreciated if anyone can come up a script to do the
> > followings:
> > 1. Find out matching instances and grep those user names from
> > /etc/passwd file
> > against my UID list file;
> > 2. Then insert a random string or at least one specified string into
> > the passwd
> > field of the /etc/shadow file for those user names returned from step
> > 1.
> >
> > Best Regards & Wishes for the Holiday
> >
> > Alan
> > _______________________________________________
> > SunHELP maillist - SunHELP at sunhelp.org
> > http://www.sunhelp.org/mailman/listinfo/sunhelp
> _______________________________________________
> SunHELP maillist - SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp
--
.********* Fight Back! It may not be just YOUR life at risk. *********.
: phil stracchino : unix ronin : renaissance man : mystic zen biker geek :
: alaric at caerllewys.net : alaric-ruthven at earthlink.net : phil at latt.net :
: 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold) :
: Linux Now! ...Because friends don't let friends use Microsoft. :
More information about the SunHELP
mailing list