Re: random password

From: Don Hiscock (dhiscock_at_ssbux1.env.gov.bc.ca)
Date: 06/24/04

  • Next message: Mike Arnold: "HP-UX 11i how to retrieve long command line of process with C"
    Date: Thu, 24 Jun 2004 13:35:45 -0700
    
    

    In perl you can use srand, rand for a random nuber. You could use something
    like $$ or time() to set the seed in srand. To create a passwd hash to
    update the /tcb file or passwd file, eg.:

      $cleartext = "secret";
      $salt_str="./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" .
            "abcdefghijklmnopqrstuvwxyz"; # set a random password salt
      srand($$);
      $salt=substr($salt_str,rand(63),1).substr($salt_str,rand(63),1);
      $hash=crypt($cleartext, $salt); # encrypt it

    "Patrick" <Patrick@nospam.nl> wrote in message
    news:3qcld0lh3pdhdibm0spk1rk1r5be8odabv@4ax.com...
    > Hi all,
    >
    > Is there a way generate some random password in a script and directly
    > change the password of a user. Al this in a script.
    >
    > Tnx, Patrick
    >
    >


  • Next message: Mike Arnold: "HP-UX 11i how to retrieve long command line of process with C"
  • Quantcast