On Sun, Jan 29, 2012 at 11:39:46PM +0100, Stefan Schulte wrote:
> On Sun, Jan 29, 2012 at 07:26:13AM -0800, Olivier wrote:
> > Hello
> > 
> > in James Loope's book (called Managing Infrastructure with Puppet), he
> > writes on page23: "The password hash can either be mined out of a
> > shadow file or generated with the mkpasswd utility." My question is:
> > how can the hash field be mined out of the shadow field. I tried to
> > use the generate function to execute the following command:
> > grep username /etc/shadow | cut -d: -f2
> > but that did not work. It seems that the generate function does not
> > like the | pipe command.
> > 
> > My question is: how can I extract that hash value and store it in a
> > Puppet variable?
> > 
> > Thank you
> > 
> 
> The question is what are you trying to accomplish?
> 
Searched the book online. This is what he is trying to say:

You can make sure that a user has a certain login password with the
`password` property of the user resource. But you have to supply the
hashed password as it would be stored in the /etc/shadow file.

But in general you just know the clear text password. An easy way to get
the hash value for your clear text password is to set the clear text
password with passwd and then lookup the hash in the /etc/shadow file
or use the mkpasswd utility (with which I am not familiar)

Once you have the hashed value of your desired clear text password
you can copy&paste that in the user definition.

-Stefan

Attachment: pgpvWSYCL4KDE.pgp
Description: PGP signature

Reply via email to