title: Managing a user password for linux in puppet
body: <p>I need to create a test user with a password using puppet.</p>
  
  <p>I've read that puppet cannot manage user passwords in a generic cross-platform way, which is a pity.
  I am doing this for Red Hat Enterprise Linux Server release 6.3.</p>
  
  <p>I do as follows:</p>
  
  <pre><code>user { 'test_user': 
    ensure   =&gt; present,
    password =&gt; sha1('hello'),
  }
  </code></pre>
  
  <p>puppet updates the password of the user,
  but Linux says login/pwd incorrect when I try to log in.</p>
  
  <p>It works (I can login) if I set the password manually in Linux with <code>sudo passwd test_user</code>, and then look at <code>/etc/shadow</code> and hardcode that value in puppet. something like:</p>
  
  <pre><code>user { 'test_user': 
    ensure   =&gt; present,
    password =&gt; '$1$zi13KdCr$zJvdWm5h552P8b34AjxO11',
  }
  </code></pre>
  
  <p>I've tried also by adding <code>$1$</code> in front of the <code>sha1('hello')</code>,
  but it does not work either (note, <code>$1$</code> stands for sha1).</p>
  
  <p>How to modify the first example to make it work (using the plaintext password in the puppet file)?</p>
  
  <p>P.S.: I am aware that I should use LDAP, or sshkeys, or something else, instead of hardcoding the user passwords in the puppet file. however, I am doing this only for running a puppet vagrant test, so it is ok to hardcode the user password.</p>