<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2657.34">
<TITLE>rebuilding accounts</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Howdy:</FONT>
</P>

<P><FONT SIZE=2>Running RHEL v.3.</FONT>
</P>

<P><FONT SIZE=2>I'm moving user home directories to the new </FONT>
<BR><FONT SIZE=2>server and I need to add them to passwd / shadow</FONT>
<BR><FONT SIZE=2>and group files.  I make a script like so:</FONT>
</P>

<P><FONT SIZE=2>[snip]</FONT>
<BR><FONT SIZE=2>#!/bin/bash -x</FONT>
</P>

<P><FONT SIZE=2>echo "building users account"</FONT>
<BR><FONT SIZE=2>echo " "</FONT>
</P>

<P><FONT SIZE=2>for i in `cat /tmp/lusers.txt`</FONT>
<BR><FONT SIZE=2>do</FONT>
<BR><FONT SIZE=2>echo "making account for the user: $i"</FONT>
<BR><FONT SIZE=2>echo " "</FONT>
<BR><FONT SIZE=2>/usr/sbin/useradd -d /opt/home/$i -g users -M -p $i -s /bin/bash $i</FONT>
<BR><FONT SIZE=2>done</FONT>
<BR><FONT SIZE=2>[/snip]</FONT>
</P>

<P><FONT SIZE=2>The when I try to su - <user>, I get 'su: incorrect password'.</FONT>
<BR><FONT SIZE=2>(note: I did this as a non-root user). I thought that </FONT>
<BR><FONT SIZE=2>maybe I should use single or double quotes when putting </FONT>
<BR><FONT SIZE=2>the password on the line, but the errors are always the same.</FONT>
</P>

<P><FONT SIZE=2>Question:  With useradd, is there a way to prompt users</FONT>
<BR><FONT SIZE=2>for a new password upon login?  Otherwise, I will have</FONT>
<BR><FONT SIZE=2>to write some one-liner to use 'passwd' to generate</FONT>
<BR><FONT SIZE=2>default passwords.</FONT>
</P>

<P><FONT SIZE=2>Thanks!</FONT>
</P>

<P><FONT SIZE=2>-X</FONT>
</P>

</BODY>
</HTML>