<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to delete users synced in ambari server in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97556#M10998</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/128/nbalaji-elangovan.html" nodeid="128"&gt;@nbalaji-elangovan&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Please see this &lt;A target="_blank" href="https://community.hortonworks.com/questions/2904/how-do-i-remove-ldap-accounts-from-ambari.html"&gt;https://community.hortonworks.com/questions/2904/how-do-i-remove-ldap-accounts-from-ambari.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Nov 2015 02:21:25 GMT</pubDate>
    <dc:creator>nsabharwal</dc:creator>
    <dc:date>2015-11-25T02:21:25Z</dc:date>
    <item>
      <title>How to delete users synced in ambari server</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97555#M10997</link>
      <description />
      <pubDate>Wed, 25 Nov 2015 02:17:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97555#M10997</guid>
      <dc:creator>nbalaji-elangov</dc:creator>
      <dc:date>2015-11-25T02:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete users synced in ambari server</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97556#M10998</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/128/nbalaji-elangovan.html" nodeid="128"&gt;@nbalaji-elangovan&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Please see this &lt;A target="_blank" href="https://community.hortonworks.com/questions/2904/how-do-i-remove-ldap-accounts-from-ambari.html"&gt;https://community.hortonworks.com/questions/2904/how-do-i-remove-ldap-accounts-from-ambari.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 02:21:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97556#M10998</guid>
      <dc:creator>nsabharwal</dc:creator>
      <dc:date>2015-11-25T02:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete users synced in ambari server</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97557#M10999</link>
      <description>&lt;P&gt;How to delete all LDAP users alone using REST API ? we have 250,000 LDAP users. Cannot remove individually.&lt;/P&gt;&lt;P&gt;Other option : Will deleting the users from database table "users" solve this ? Does the table have any dependencies or constraints that we need to take care.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 02:32:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97557#M10999</guid>
      <dc:creator>nbalaji-elangov</dc:creator>
      <dc:date>2015-11-25T02:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete users synced in ambari server</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97558#M11000</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/128/nbalaji-elangovan.html" nodeid="128"&gt;@nbalaji-elangovan&lt;/A&gt;  There is jira opened by &lt;A rel="user" href="https://community.cloudera.com/users/32/paul.html" nodeid="32"&gt;@Paul Codding&lt;/A&gt; to delete users from CLI&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 10:41:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97558#M11000</guid>
      <dc:creator>nsabharwal</dc:creator>
      <dc:date>2015-11-25T10:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete users synced in ambari server</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97559#M11001</link>
      <description>&lt;P&gt;You can script it using the following python script [delete_users.py]:&lt;/P&gt;&lt;PRE&gt;import sys,json
from string import Template 
password='admin'
ambari_host='revo5.hortonworks.local'
request = Template("echo 'Removing $user_name'\ncurl --insecure -u admin:$password -H 'X-Requested-By: ambari' -X DELETE http://$ambari_host:8080/api/v1/users/$user_name")
payload = json.load(sys.stdin)
for user in payload["items"]:
    if user["Users"]["ldap_user"]:
        print request.substitute(password=password,ambari_host=ambari_host,user_name=user["Users"]["user_name"])&lt;/PRE&gt;&lt;P&gt;$ curl -u admin:admin 'http://revo5.hortonworks.local:8080/api/v1/users/?Users/user_name.matches%28.*.*%29&amp;amp;fields=*' &amp;gt; users.json&lt;/P&gt;&lt;P&gt;$ cat users.json | python delete_users.py &amp;gt; delete_users.sh&lt;/P&gt;&lt;P&gt;The python script will output an echo statement for the username and a curl request delete each LDAP user.  You can review that shell script as it will have all of the individual curl commands to delete the LDAP users that have been sync'd into Ambari.  Once you're comfortable with the list you can run it with bash and observe the process.&lt;/P&gt;&lt;P&gt;$ bash delete_users.sh&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 13:21:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97559#M11001</guid>
      <dc:creator>pcodding</dc:creator>
      <dc:date>2015-11-25T13:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete users synced in ambari server</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97560#M11002</link>
      <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/32/paul.html" nodeid="32"&gt;@Paul Codding&lt;/A&gt;. This needs to go into offical docs &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 19:15:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97560#M11002</guid>
      <dc:creator>nsabharwal</dc:creator>
      <dc:date>2015-11-25T19:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete users synced in ambari server</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97561#M11003</link>
      <description>&lt;P&gt;Paul Coddling solution worked for me.  I am using HDP 3.0.1 and was able to use this solution to remove over 800 users via the REST API.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I did have 2 conditions that I had to resolve manually:&lt;/P&gt;&lt;P&gt;1) for users with a $ in their name I had to escape them in the delete_users.sh script.  So '...users/$somenamehere' becomes '...users/\$somenamehere'.  I had 95 of these so I used vi to do a search and replace like this:&lt;/P&gt;&lt;P&gt;:%s/users\/\$/users\/\\$/g&lt;BR /&gt;2) This didn't work for users with a space in the name.  I only had one like this so I replaced the space with a %20 and executed the curl command manually.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If someone had the time they could pull the statement to recreate the users.json into the python script, loop through them all and edit the names if needed and then execute the python statement. But I got this to work pretty quickly and didn't mind making the manual changes.  &lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 04:09:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-users-synced-in-ambari-server/m-p/97561#M11003</guid>
      <dc:creator>sinman</dc:creator>
      <dc:date>2019-04-04T04:09:29Z</dc:date>
    </item>
  </channel>
</rss>

