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

useradd -p




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.