title: Ubuntu Linux useradd with -p option
body: <p>I'm trying to add a user in Ubuntu Linux 11.04 with a single useradd directive.</p>
  
  <p>I found something similar here but I can't seem to figure it out completely:
  <a href="https://stackoverflow.com/questions/1020534/useradd-using-crypt-password-generation">Useradd using crypt password generation</a></p>
  
  <p>Let's say my username is ohill and my password is justpass, what would the command line directive be exactly? Here is what I have so far that I borrowed from the above link.</p>
  
  <pre><code>useradd -p $(perl -e 'print crypt("justpass", "aa")') -g sudo -s /bin/bash -m ohill
  </code></pre>
  
  <p>It doesn't seem to work and I'm sure I'm missing something. </p>
  
  <p>Any ideas or an easier way? I'm looking for something I can easily put in a shell script.</p>