develooper Front page | perl.beginners | Postings from December 2002

crypt()

Thread Next
From:
Jerry M . Howell II
Date:
December 8, 2002 03:18
Subject:
crypt()
Message ID:
20021208053309.5c7b5ef8.jmhowell@jmhowell.com
hello there,

   Got another question. as far as I know I need the following to encrypt
a passwd in perl. I plan to use it to add a users to my /etc/passwd /etc/shadow
and /etc/group now I got a question cuz most newbees do :) what am I missing
in this script I've narowed it down to the crypt command and found out in the
cammel book it should be crypt(plaintext,salt) if I understood it corectly.
what do I need for the salt????
my script is the following (don't laugh to hard :))

#!/usr/bin/perl
print "Enter your preferd username.\n";
$username = <STDIN>;
chomp($username);
print "enter your prefered password\n";
$passwd = <STDIN>;
$passwd=crypt($passwd);
chomp($passwd);
print `/usr/sbin/useradd "$username" -p "$passwd"`;

-- 
Jerry M. Howell II

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About