Zentyal LDAP Passwords change

Zentyal LDAP Passwords change


#!/usr/bin/perl
use strict;
use warnings;
use EBox;
use EBox::UsersAndGroups;
use EBox::Global;
use EBox::Util::Random;
EBox::init();
my $salida =”/tmp/users.csv”;
open (OUT,”>$out”) || die “ERROR: Can’t create or write to file $outn”;
my $users = EBox::Global->modInstance(‘users’);
my @userlist = @{$users->users() } ;
foreach my $user (@userlist) {
my $password;
$password = EBox::Util::Random::generate(8);
print OUT $user->name().” “. $password.”n”;
$user->changePassword($password,0)
}

close (OUT);

– See more at: http://www.jbahillo.com/perl-zentyal-ldap-passwords-change/#sthash.t5B9uZhJ.dpuf