{"id":541,"date":"2013-02-18T22:00:21","date_gmt":"2013-02-18T21:00:21","guid":{"rendered":"http:\/\/www.jbahillo.com\/?p=541"},"modified":"2013-07-29T12:38:04","modified_gmt":"2013-07-29T11:38:04","slug":"zentyal-bulk-ldap-passwords-change","status":"publish","type":"post","link":"https:\/\/www.jbahillo.com\/?p=541","title":{"rendered":"Zentyal Bulk 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\">\r\n#!\/usr\/bin\/perl\r\nuse strict;\r\nuse warnings;\r\nuse EBox;\r\nuse EBox::UsersAndGroups;\r\nuse EBox::Global;\r\nuse EBox::Util::Random;\r\nEBox::init();\r\n\r\nmy $salida =&quot;\/tmp\/users.csv&quot;;\r\nopen (OUT,&quot;&gt;$out&quot;) || die &quot;ERROR: Can&#039;t create or write to file $out\\n&quot;;\r\nmy $users = EBox::Global-&gt;modInstance(&#039;users&#039;);\r\nmy @userlist = @{$users-&gt;users()   }  ;\r\nforeach my $user (@userlist) {\r\n        my $password;\r\n        $password =  EBox::Util::Random::generate(8);\r\n        print OUT $user-&gt;name().&quot; &quot;. $password.&quot;\\n&quot;;\r\n        $user-&gt;changePassword($password,0)\r\n}\r\n  close (OUT);\r\n\r\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\/?p=541\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[10,96],"tags":[102,101,97],"class_list":["post-541","post","type-post","status-publish","format-standard","hentry","category-gnulinux","category-zentyal","tag-ldap","tag-passwords","tag-zentyal-2"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p74T96-8J","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/posts\/541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"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=541"}],"version-history":[{"count":9,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/posts\/541\/revisions"}],"predecessor-version":[{"id":691,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/posts\/541\/revisions\/691"}],"wp:attachment":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}