|
useradd from script question
I can create a new account using useradd and everything is fine (all files and dir's are created), but if I try to login as that user I cannot.
the exact line I am running is
sudo useradd -p password -g usergroup newuser
This doesn't seem to work.
However, if I use the GUI to add a user all works out just fine. Also, if I add a user without using the -p switch and manually enter the password at the prompt it works.
I have a sneaking suspicion that I am doing something wrong with the -p switch.
Reading the man pages (and searching the net to find more copies of the man page, arrgh) I have tripped over a troubling quote that I was hoping someone would be able to interpret for me.
"-p passwd
The encrypted password, as returned by crypt(3). The default is to disable the account."
"as returned by crypt"
If I want to include -p as a switch do I first have to run crypt? if so, can I pass a variable to useradd from inside a script?
You see, I'm trying to run useradd from a script. (maintence shortcut)
Why do I post these things when 1/2 way through I figure out the answer or at least something else to try.
Why am I even posting this?
Ah yes, just in case someone else needs an answer to this question I suppose or if someone knows of a better option, or if this idea doesn't work I've already posted the problem.
I'll be back with a report either way. Thank you for your ideas.
Last edited by Strixy; 08-04-2005 at 10:41 PM.
|