nikosd23
2012-Jul-02 15:10 UTC
[Puppet Users] Problem during setting password for user, using puppet provisioner of Vagrant
Hi, I am trying to set the password for a user that I have created using the puppet provisioner of Vagrant for a Linux version 2.6.32-71.el6.x86_64 Red Hat 4.4.4-13 box. I have tried both approaches: Approach1 user { "test": ensure => present, shell => "/bin/bash", password => "encrypted_password_generated_by_passwd_command", managehome => true, } Approach2 exec { "create-test-password": onlyif => "/bin/egrep ''^test:'' /etc/passwd", command => ''/usr/sbin/usermod -p $6$BlODgWJe$eQ.xkRSzkXpMudl831q78I8lh4hHLVGVKds.6hpcPe348uoqWXmlf6PC1s4TfmPhYrPHo6dbdbmNkz2UxewfS1 test'', require => User["test"], } The first approach fills in the /etc/shadow file with an entry !! concerning the hashed password of the specific user, The second approach fills in a part of the above hashed password the /etc/shadow file entry., ie. for the above example: test:.xkRSzkXpMudl831q78I8lh4hHLVGVKds.6hpcPe348uoqWXmlf6PC1s4TfmPhYrPHo6dbdbmNkz2UxewfS1:15523:0:99999:7::: Is there something I am missing? Is there any other approach that I should use? My puppet version is 2.7.1 ( and my Vagrant version is 1.0.3 although I dont know if this relates with my problem) . Thanks in advance. -- 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/-/tYRgMXG0SxQJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Brian Gupta
2012-Jul-02 19:24 UTC
Re: [Puppet Users] Problem during setting password for user, using puppet provisioner of Vagrant
On Mon, Jul 2, 2012 at 11:10 AM, nikosd23 <nikosd23@gmail.com> wrote:> Hi, > > I am trying to set the password for a user that I have created using the > puppet provisioner of Vagrant for a Linux version 2.6.32-71.el6.x86_64 Red > Hat 4.4.4-13 box. > > I have tried both approaches: > > Approach1 > user { "test": > ensure => present, > shell => "/bin/bash", > password => "encrypted_password_generated_by_passwd_command", > managehome => true, > }This is the approach I would take, but you need libshadow-ruby installed for it to work.> > Approach2 > exec { "create-test-password": > onlyif => "/bin/egrep ''^test:'' /etc/passwd", > command => ''/usr/sbin/usermod -p > $6$BlODgWJe$eQ.xkRSzkXpMudl831q78I8lh4hHLVGVKds.6hpcPe348uoqWXmlf6PC1s4TfmPhYrPHo6dbdbmNkz2UxewfS1 > test'', > require => User["test"], > } > > The first approach fills in the /etc/shadow file with an entry !! concerning > the hashed password of the specific user, > > The second approach fills in a part of the above hashed password the > /etc/shadow file entry., ie. for the above example: > > test:.xkRSzkXpMudl831q78I8lh4hHLVGVKds.6hpcPe348uoqWXmlf6PC1s4TfmPhYrPHo6dbdbmNkz2UxewfS1:15523:0:99999:7::: > > Is there something I am missing? Is there any other approach that I should > use? > > My puppet version is 2.7.1 ( and my Vagrant version is 1.0.3 although I dont > know if this relates with my problem) . > > Thanks in advance. > > > > -- > 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/-/tYRgMXG0SxQJ. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2012-Jul-03 19:56 UTC
Re: [Puppet Users] Problem during setting password for user, using puppet provisioner of Vagrant
On Monday, July 2, 2012 2:24:15 PM UTC-5, Brian Gupta wrote:> > On Mon, Jul 2, 2012 at 11:10 AM, nikosd23 <nikosd23@gmail.com> wrote: > > Hi, > > > > I am trying to set the password for a user that I have created using the > > puppet provisioner of Vagrant for a Linux version 2.6.32-71.el6.x86_64 > Red > > Hat 4.4.4-13 box. > > > > I have tried both approaches: > > > > Approach1 > > user { "test": > > ensure => present, > > shell => "/bin/bash", > > password => "encrypted_password_generated_by_passwd_command", > > managehome => true, > > } > > This is the approach I would take, but you need libshadow-ruby > installed for it to work. >Also, it''s a good idea to use single quotes around the password hash instead of double quotes. Password hashes have an unfortunate tendency to include ''$'' characters, which Puppet will tend to try to interpret as a variable reference except when the string is single-quoted. In fact, it''s a good idea to always use single quotes in your Puppet manifests except where you specifically want variable interpolation. John -- 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/-/-CMO2v9TEqcJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.