title: Useradd using crypt password generation
body: <p>I am working on what I thought was a very simple script to dynamically create an FTP user using 'useradd' There are several parts of this process I am unfamiliar with, and an entire day's research has not gotten me too far. Here is what I have:</p>
  
  <pre><code>password="pass"
  pass=$(perl -e 'print crypt($ARGV[0], "wtf")' $password)
  useradd -d HOME_DIR -s /bin/bash -g GROUP -p $pass -f -1 testing
  </code></pre>
  
  <p>Notes</p>
  
  <ol>
  <li>HOME_DIR and GROUP are placeholders </li>
  <li>I am not having issues with the home/base_dir (-d, -b) or group (-g) functionality of 'useradd'</li>
  </ol>
  
  <p>Topics:</p>
  
  <ol>
  <li>Why are my password generation efforts not working?</li>
  <li>is /bin/bash the correct shell to use for a purely FTP user, or would I use /bin/false or a different shell?</li>
  <li>By default, useradd disables an account until they provide their own password, how do I bypass this?</li>
  <li>I do not want to use the passwd utility as it cripples my ability to automagically generate FTP accounts, I found a solution to this <a href="https://stackoverflow.com/questions/714915/using-the-passwd-command-from-within-a-shell-script">here</a>, but I do not understand the solution</li>
  </ol>
  
  <p>Let me know if I am going about this all wrong, or if what I am trying to do is not possible or if I am misinformed about anything I have stated herein. Thank you for any help you can provide. :D</p>