Re: rebuilding accounts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The -p option of 'useradd' requires an _encryprted_ password as its
argument.
As I can see from your message, you want to set the user's password
equal to his login.
I recommend you set password separately, using the 'passwd' command.
For example:

for i in `cat /tmp/lusers.txt' ; do
	useradd -d /opt/home/$i -g users -M -s /bin/bash $i
	echo $i | passwd --stdin $i
done

Alexey Fadyushin
Brainbench MVP for Linux
http://www.brainbench.com

> "Johnson, Shaunn" wrote:
> 
> Howdy:
> 
> Running RHEL v.3.
> 
> I'm moving user home directories to the new
> server and I need to add them to passwd / shadow
> and group files.  I make a script like so:
> 
> [snip]
> #!/bin/bash -x
> 
> echo "building users account"
> echo " "
> 
> for i in `cat /tmp/lusers.txt`
> do
> echo "making account for the user: $i"
> echo " "
> /usr/sbin/useradd -d /opt/home/$i -g users -M -p $i -s /bin/bash $i
> done
> [/snip]
> 
> The when I try to su - <user>, I get 'su: incorrect password'.
> (note: I did this as a non-root user). I thought that
> maybe I should use single or double quotes when putting
> the password on the line, but the errors are always the same.
> 
> Question:  With useradd, is there a way to prompt users
> for a new password upon login?  Otherwise, I will have
> to write some one-liner to use 'passwd' to generate
> default passwords.
> 
> Thanks!
> 
> -X
> 
>     ---------------------------------------------------------------
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux