daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Apr 26th, 2018 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # hash: login, uid, pass, dir,
  2. sub add_user {
  3.     my(%args) = %{$_[0]};
  4.     my $command = "adduser -m ";
  5.    
  6.     if (defined $args{'uid'})  {
  7.         $command .= "-u ".$args{'uid'};
  8.     }
  9.    
  10.     if (defined $args{'dir'})  {
  11.         $command .= "-k ".$args{'dir'};
  12.     }
  13.    
  14.     if (defined $args{'pass'})  {
  15.         $command .= "-p ".crypt($args{'pass'}, "AA");
  16.     }
  17.    
  18.     $command .= " ".$args{'login'};
  19.    
  20.     print $command;
  21.    
  22.     if ($? == 1) {
  23.         print STDERR "Can'd add user, maybe gid is taken?"
  24.     }
  25. }
  26.  
  27. # args login
  28. sub del_user {
  29.     my $login = shift;
  30.     system("deluser ".$login);
  31. }
  32.  
  33.  
  34.  
  35. # print find_free_uid();
  36. # change_gid('couchdb', 118);
  37. #print generate_password(20);
  38. #print home_dir("ymir");
  39. my %user = (login => 'testuser', pass => 'password');
  40.  
  41. &add_user(\%user);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top