> -----Original Message----- > From: redhat-list-admin@xxxxxxxxxx > [mailto:redhat-list-admin@xxxxxxxxxx]On Behalf Of Marvin Blackburn > Sent: Tuesday, December 02, 2003 7:13 AM > To: Red Hat Mailing List (E-mail) > Subject: automatically generating an encrypted passwd for useradd -p > > > I need a method for automatically generating a crypt(3) > password so I can > input it into the > usermod -p command to force a user to enter a new password > when logging in. > > I saw a way to use python to generate the key, but its not > automatated. > > Any help would be appreciated. > I am running RHEL ES2.1 Are you looking for a way to force the user to enter a password at next login or to automatically set the password to something? If you're just looking for a way to create the hash, you can use a perl script like below. Call it "gen_crypt.pl" and use it with usermod like "usermod -p $( gen_crypt.pl somepass ) username": #!/usr/bin/perl my $pass = shift; my @salts = ( 'a' .. 'z', 'A' .. 'Z', 0 .. 9, '.', '/' ); print crypt( $pass, join( "", map { $salts[ rand( scalar(@salts) ) ] } ( 1, 2 ) ) ); -Steve -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list