You do not say what distribution of Linux you are using. By any chance is it
Red Hat?
I encountered the same problem when I went from slackware to Red Hat
(Slackware is better in my estimation, but my company has stanardized on Red
Hat). If you put in a password using the -p switch in user add it copies that
password exactly as it appears on the command line into the shadow file. It
does not encrypt it first. To use the -p switch you first have to run crypt on
the password, and then put the results of crypt after the -p switch. This of
course could be automated with a simple script, e.g. (I haven't tried the
below script so I'm not sure it would work right).
#!/bin/sh
# run script by supplying username and password as first and secong
# arguments:
# makeuser username password
encry=crypt $2
useradd -g users -p $encry $1
But what you really want to know is how to fix your problem. As root open the
file /etc/shadow. In it you will find the user acct you created. The fields
are seperated by colons. The first field is the username, the second name
should be the encrypted password. In your case you should find the password
exactly as it was typed in at the command line. Delete that password (just
between the two colons). Save your changes and exit vi. Now that user acct is
passwordless. Log into that acct and run passwd to assign a password to the
acct. This time it will be properly encrypted in /etc/shadow.
Ray Olszewski <[EMAIL PROTECTED]> wrote:
> The two standard programs for this purpose are useradd and adduser. I can
> never remember which is which (the names aren't all that hard to mix up,
> after all),but both work on systems I am familiar with.
>
> So ...
>
> 1. Try adduser.
>
> 2. Check if you are using a version of "useradd" that doesn't go with your
> system. Possibly it assumes regular passwords, while your system uses
shadow
> passwords.
>
> 3. Do it by hand. This is a bit tricky, but the steps are:
>
> A. Use an editor to add an entry to /etc/passwd . BE VERY CAREFUL
in
> doing this; if you mess up the file, you can make all logins impossible,
> (That's why we have apps like useradd and adduser.) Use an existing entry
as
> a template for the new one.
>
> B. Assuming you use shadow passwords, add a similar entry in
> /etc/shadow .
>
> C. Run "passwd" to give the account a password.
>
> D. Create the account's home directory; e.g.,
> mkdir /home/someuser
> chown someuser /home/someuser
> chgrp somegroup /home/someuser
>
> This is barebones, but it will get a new account working.
>
> 4. IF none of these solutions appeals to you, write again, but this time
> include enough detail that we have a shot at figuring out what is wrong
with
> "useradd". At the least, tell us what distribution, version, and kernel
> version ("uname -a") of Linux you are using; whether it uses regular or
> shadow passwords; and how the failures of useradd manifest themselves (what
> message do you get when logging i; what is the entry created in
/etc/passwd;
> what is the entry created in /etc/shadow?).
>
> At 02:51 PM 3/13/00 -0000, Archana Bharathidasan wrote:
> >Hi,
> >
> >I would like to know in detail the steps to add a non-priviledged user
> account in linux. Useradd doesnt work...it adds the newuser to the passwd
> file but I am not able to login using that name and password. Please help!
>
> ------------------------------------"Never tell me the odds!"---
> Ray Olszewski -- Han Solo
> Palo Alto, CA [EMAIL PROTECTED]
> ----------------------------------------------------------------
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to [EMAIL PROTECTED]
> Please read the FAQ at http://www.linux-learn.org/faqs
--
R. Haehnel
____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at
http://webmail.netscape.com.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs