{"id":545,"date":"2013-02-18T22:06:44","date_gmt":"2013-02-18T21:06:44","guid":{"rendered":"http:\/\/www.jbahillo.com\/?page_id=545"},"modified":"2013-02-21T18:22:46","modified_gmt":"2013-02-21T17:22:46","slug":"perl-zentyal-ldap-passwords-change","status":"publish","type":"page","link":"https:\/\/www.jbahillo.com\/?page_id=545","title":{"rendered":"[Perl] Zentyal LDAP Passwords change"},"content":{"rendered":"<p>This is a small script I have done today in Zentyal that allows you to change the passwords of all users in LDAP. It creates a file \/tmp\/usuarios.csv with the users and their new passwords<\/p>\n<pre class=\"brush: perl; auto-links: true; collapse: false; gutter: true; first-line: 1; highlight: []; html-script: false; light: false; pad-line-numbers: true; toolbar: true; wrap-lines: true\">\n#!\/usr\/bin\/perl\nuse strict;\nuse warnings;\nuse EBox;\nuse EBox::UsersAndGroups;\nuse EBox::Global;\nuse EBox::Util::Random;\nEBox::init();\n\nmy $salida =&quot;\/tmp\/users.csv&quot;;\nopen (OUT,&quot;&gt;$out&quot;) || die &quot;ERROR: Can&#039;t create or write to file $out\\n&quot;;\nmy $users = EBox::Global-&gt;modInstance(&#039;users&#039;);\nmy @userlist = @{$users-&gt;users()   }  ;\nforeach my $user (@userlist) {\n        my $password;\n        $password =  EBox::Util::Random::generate(8);\n        print OUT $user-&gt;name().&quot; &quot;. $password.&quot;\\n&quot;;\n        $user-&gt;changePassword($password,0)\n}\n  close (OUT); \n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is a small script I have done today in Zentyal that allows you to change the passwords of all users in LDAP. It creates a file \/tmp\/usuarios.csv with the users and their new passwords #!\/usr\/bin\/perl use strict; use warnings;&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/www.jbahillo.com\/?page_id=545\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":21,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"ep_exclude_from_search":false,"footnotes":""},"class_list":["post-545","page","type-page","status-publish","hentry"],"aioseo_notices":[],"jetpack_shortlink":"https:\/\/wp.me\/P74T96-8N","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/pages\/545","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=545"}],"version-history":[{"count":4,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/pages\/545\/revisions"}],"predecessor-version":[{"id":551,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/pages\/545\/revisions\/551"}],"wp:attachment":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}