I do this a lot:
yes 'PASSWORD' | passwd username
Then you can extract the password from /etc/shadow
also see here:
--
vagn
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/cr268oS6l2oJ.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
This will help :
http://docs.puppetlabs.com/references/2.7.0/type.html#user-3
Otherwise, it's really just as simple as this :
user { 'student_account':
name => 'username',
password => '$6$xx...' # this is the crypted password string.
}
You can also set their group membership, home directory, uid, and other
things as well. Just ensure that the user statement is in a class
that's included on all of your target machines, and you're done.
--
dan.
No need to go over /etc/shadow or use mkpasswd (which is not available
that easy on all distros). How about
# salt=`pwgen 8 1`; pass=`pwgen -s 12 1`;ruby -e "puts \
ARGV[0].crypt('\$6\$' << ARGV[1] << '\$')" $pass $salt; echo $pass
$6$eemaihic$3gwFGQxMWE8n/KMZlNe3O9dVoQC5zCXrtabhpCLeDp54eYTGK8WAHovxYZLaQf8YF93Hwfh466CQ966Xoh6O81
FmstT8KObWVu
?
~pete
?
~pete
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
or you can use something like trocla to not even store the encrypted
password in the manifest:
https://github.com/duritong/trocla
https://github.com/duritong/puppet-trocla
~pete
-Eric
Ohad
> ?
>
> ~pete
Make sure to use single-quotes, or puppet will try to evaluate variables "$PVOar", "$WUTN", etc., etc.
D