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

Re: useradd -p




I ran authconfig to verify that I was not using MD5 passwords, and indeed, 
I'm not. I havent compared the strings exactly, so i'll stick a print 
statement in my code and see what comes out. 

thanks! -c


On Mon, 1 Apr 2002, Danny Sauer wrote:

> Are you on a system that uses MD5 passwords or something like that?
> I've done that exact thing before (except for using my own random
> function just to spite the String::Random author ;)) and it worked
> fine.  I suggest the use of single quotes, to protect shell metachars
> and make the code cleaner.  If you're sure that the value getting put
> into /etc/shadow is the same as the one the program generates, then 
> that's not your problem.
> 
> --Danny, merely dumping thoughts that might help 
> 
> On Mon, Apr 01, 2002 at 03:51:00PM -0600, Charles Menzes wrote:
> > 
> > the man page for useradd shows that the '-p' flag  is used to specify an 
> > already encrypted password string as as returned by crypt(3).
> > 
> > in my (very) simple perl script, i have:
> > 
> >     ## generate random characters
> >     my $random = new String::Random;
> > 
> >     ## salt the passwd
> >     my $salt = $random->randpattern("ss");
> > 
> >     ## encrypt the password
> >     my $crypt = crypt($first_pass, $salt);
> > 
> >     ## return encrypted password to root routine
> >     return ($crypt);
> > 
> > this just passes teh value of $crypt to a system call to 'useradd' that 
> > uses /-p "$crypt"/. the user is added to the system and the string passed 
> > through -p is used in /etc/shadow, however when i try to log in as the 
> > user, i get an error of incorrect password. my system call is...
> > 
> >   system("/usr/sbin/useradd -c \"$gecos\" -d $home -G $gid -s $shell -p 
> > \"$password\" $username");
> > 
> > am i missing something in the useradd usage or in perl?
> > 
> > 
> > -
> > To unsubscribe, send email to majordomo@luci.org with
> > "unsubscribe luci-discuss" in the body.
> 
> -
> To unsubscribe, send email to majordomo@luci.org with
> "unsubscribe luci-discuss" in the body.
> 


-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.