On Wed, Jan 27, 2010 at 05:14:51PM +0000, Paul Branston wrote:
> On Wed, Jan 27, 2010 at 05:48:15PM +0100, Jordi Espasa Clofent wrote:
> >> Have you looked at man usermod? -p flag in particular.
> >
> > Shame on me, indeed. It has been a game:
> >
> > #!/bin/sh
> > PASSWORD=$(echo "my_new_password" | encrypt -b 6)
> > usermod -p $PASSWORD root
> >
> 
> A little more generic in case there is no usermod -p
> 
> PASSWORD=$(echo "my_new_password" | encrypt -b 6)
> perl -p -i.bk -e  's/^root:.*?:/root:$PASSWORD:/' /etc/shadow

Breaks on AIX :-).  Breaks with NIS and LDAP as well :-).

I've always had the pipe dream of there being a chpasswd(8)
on *BSD like there is on current AIX and Linux distros.
But usually there isn't that much headache using something like usermod.


> 

-- 
Chris Dukes

Reply via email to