rebuilding accounts
Ryan Golhar
ryangolhar at verizon.net
Thu Apr 29 21:17:04 UTC 2004
Try escaping the quotes with backslashes. I have a script that does
something similar....it first checks to make sure the user is a valid
university account....here's my code. It also prompts the user to enter
a password (in a bash shell script):
print "Adding user $username...\n";
`/usr/sbin/useradd "$username" -g users -c \"$realname\"`;
`passwd $username`;
-----
Ryan Golhar
Computational Biologist
The Informatics Institute at
The University of Medicine & Dentistry of NJ
Phone: 973-972-5034
Fax: 973-972-7412
Email: golharam at umdnj.edu
-----Original Message-----
From: redhat-list-bounces at redhat.com
[mailto:redhat-list-bounces at redhat.com] On Behalf Of Johnson, Shaunn
Sent: Thursday, April 29, 2004 4:45 PM
To: 'General Red Hat Linux discussion list'
Subject: rebuilding accounts
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/redhat-list/attachments/20040429/0b10cb28/attachment.htm>
More information about the redhat-list
mailing list