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

Re: Adding new users automatically



On Sun, Jan 28, 2001 at 04:33:24PM +0200, Paolo Supino wrote:
>    I'm trying to automate the addition of new users (I'm fed up with
> having to run 'adduser' every time a new employee joins the company
> (which is pretty frequent). What are my options (without having to
> invent anything if possible)?

Write a small password protected cgi your human ressources staff can use ;-))
A function for random passwords in perl looks like this:

sub random_password {
# Generate a random password. Alternates vowels and
# consonants, for maximum pronounceability.  Uses its own 
# list of consonants which exclude F and C and K to prevent 
# generating obscene-sounding passwords. Capital I and 
# lowercase L are excluded on the basis of looking like 
#each other.
  ($length) = @_;
  if ($length eq "" or $length < 3) {
    $length = 8;		# make it at least $lenght chars long.
  }
  $vowels = "aeiouyAEUY";
  $consonants = "bdghjmnpqrstvwxzBDGHJLMNPQRSTVWXZ12345678";
  srand(time() ^ ($$ + ($$ << 15)) );
  $alt = int(rand(2)) - 1;
  $s = "";
  $newchar = "";
  foreach $i (0..$length-1) {
    if ($alt == 1) {
      $newchar = substr($vowels,rand(length($vowels)),1);
    } else {
      $newchar = substr($consonants, rand(length($consonants)),1);
    }
    $s .= $newchar;
    $alt = !$alt;
  }
  return $s;
}

-- 
Henning Brauer     | BS Web Services
Hostmaster BSWS    | Roedingsmarkt 14
hostmaster@bsws.de | 20459 Hamburg
http://www.bsws.de | Germany