Re: [Hampshire] [OT] Linux compatible crypt(3) password from…

Top Page

Reply to this message
Author: James Courtier-Dutton
Date:  
To: lug, Hampshire LUG Discussion List
Subject: Re: [Hampshire] [OT] Linux compatible crypt(3) password from Perl
2009/5/9 Damian Brasher <lug@???>:
> I am writing subroutine to generate a Linux compatible password for the
> command useradd executed from within a Perl script, where useradd can be
> supplied a compatible encrytped password as with crypt(3) generated
> passwords. I need something like this:
>
> my $ADD_USER="/usr/sbin/useradd -g users -G sshd -d /home/n_user -m -p
> ${crypt_user_pass} n_user";
>


You should probably check /etc/login.defs

cyrpt generates the older md5 based salt password.
login.defs allows for more modern hashes being used, e.g. sha256

Just thought I would mention it, in case you start creating md5 ones
instead of sha256 or sha512 ones.

James