<?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 list all Hive databases that I have access to? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-list-all-Hive-databases-that-I-have-access-to/m-p/308616#M223634</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/83933"&gt;@PauloNeves&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, the command show databases will list all databases in a Hive instance whether you are authorized to access it or not. I am sure this is cluster devoid of Ranger or Sentry which are the 2 authorization tools in Cloudera!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once the ranger plugin is enabled then authorization is delegated to Ranger to provide fine-grained data access control in Hive, including row-level filtering and column-level masking. This is the recommended setting to make your database administration easier as it provides a centralized security administration, access control, and detailed auditing for user access within the Hadoop, Hive, HBase, and other components in the ecosystem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, I had already enabled the Ranger plugin for hive on my cluster but all the same, it confirms what I wrote above. Once the ranger plugin is enabled for a component ie. hive,HBase or Kafka then the authorization is managed exclusively through Ranger&lt;BR /&gt;&lt;BR /&gt;Database listing before Ranger&lt;BR /&gt;Below is what happens if my user &lt;FONT color="#FF6600"&gt;sheltong&lt;/FONT&gt; has not explicitly been given authorization through Ranger, see [screenshots]&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="01.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29995i2DEE1205E6157E08/image-size/large?v=v2&amp;amp;px=999" role="button" title="01.JPG" alt="01.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I see no database though I have over 8 databases&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="02.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29996i6CF09C42765D7A4B/image-size/large?v=v2&amp;amp;px=999" role="button" title="02.JPG" alt="02.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;See the output of the hive user who has explicit access to all the tables due to the default policy he could see the databases.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="04.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30002iD812293FAC641EC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="04.JPG" alt="04.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Database listing after Ranger&lt;/P&gt;&lt;P&gt;After creating a policy explicitly giving the user &lt;FONT color="#FF6600"&gt;sheltong&lt;/FONT&gt; access to the 3 databases&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="03.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29997iC5F88443E0C2244F/image-size/large?v=v2&amp;amp;px=999" role="button" title="03.JPG" alt="03.JPG" /&gt;&lt;/span&gt;&lt;BR /&gt;Policy granting explicit access to 3 databases&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="05.JPG" style="width: 838px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29998i89E9124641889D70/image-size/large?v=v2&amp;amp;px=999" role="button" title="05.JPG" alt="05.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now when I re-run the show databases bingo!&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="06.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29999i7B1191EC9B84F871/image-size/large?v=v2&amp;amp;px=999" role="button" title="06.JPG" alt="06.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Back to your question show tables from forbidden_db, it returns an empty list, this can be true especially if the database is empty! has not table like the screenshot below though I have access to the database it's empty&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="07.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30000i20970885BF59E2BF/image-size/large?v=v2&amp;amp;px=999" role="button" title="07.JPG" alt="07.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now I create a table and re-run the select now I am able to see the table&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="08.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30001iB9AC465A951F020C/image-size/large?v=v2&amp;amp;px=999" role="button" title="08.JPG" alt="08.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I hope this demonstrates the power of Ranger and explains maybe what you are encountering, I am also thinking if your cluster has Ranger hive plugin enabled you could have &lt;FONT color="#FF6600"&gt;select&lt;/FONT&gt; on the databases but you will need explicit minimum &lt;FONT color="#FF6600"&gt;select&lt;/FONT&gt;&amp;nbsp;or the following permission on the underlying database&amp;nbsp; tables to be able to see them.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="09.JPG" style="width: 759px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30003iAD3ED73E29805D21/image-size/large?v=v2&amp;amp;px=999" role="button" title="09.JPG" alt="09.JPG" /&gt;&lt;/span&gt;&lt;BR /&gt;Happy Hadooping&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 03 Jan 2021 20:44:47 GMT</pubDate>
    <dc:creator>Shelton</dc:creator>
    <dc:date>2021-01-03T20:44:47Z</dc:date>
    <item>
      <title>How to list all Hive databases that I have access to?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-list-all-Hive-databases-that-I-have-access-to/m-p/307946#M223422</link>
      <description>&lt;DIV class="postcell post-layout--right"&gt;&lt;DIV class="s-prose js-post-body"&gt;&lt;P&gt;The command &lt;FONT face="courier new,courier,monospace"&gt;show databases&lt;/FONT&gt; list all databases in a Hive instance. The command list databases that I have and don't have access to. When I try to list the tables in a DB that I don't have access to, using the command &lt;FONT face="courier new,courier,monospace"&gt;show tables from forbidden_db,&lt;/FONT&gt; it returns an empty list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which command would list all databases that I have access to at least one table?&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 17 Dec 2020 23:34:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-list-all-Hive-databases-that-I-have-access-to/m-p/307946#M223422</guid>
      <dc:creator>PauloNeves</dc:creator>
      <dc:date>2020-12-17T23:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all Hive databases that I have access to?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-list-all-Hive-databases-that-I-have-access-to/m-p/308489#M223573</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/83933"&gt;@PauloNeves&lt;/a&gt;&amp;nbsp;You have to login with your user ID in my opinion and that should have a valid kerberos ticket if kerberos is enabled and then you can only list the tables you have access that should come using list tables. You can refer this cheat seat if this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://hortonworks.com/wp-content/uploads/2016/05/Hortonworks.CheatSheet.SQLtoHive.pdf" target="_blank"&gt;http://hortonworks.com/wp-content/uploads/2016/05/Hortonworks.CheatSheet.SQLtoHive.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 14:04:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-list-all-Hive-databases-that-I-have-access-to/m-p/308489#M223573</guid>
      <dc:creator>GangWar</dc:creator>
      <dc:date>2020-12-28T14:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all Hive databases that I have access to?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-list-all-Hive-databases-that-I-have-access-to/m-p/308616#M223634</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/83933"&gt;@PauloNeves&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, the command show databases will list all databases in a Hive instance whether you are authorized to access it or not. I am sure this is cluster devoid of Ranger or Sentry which are the 2 authorization tools in Cloudera!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once the ranger plugin is enabled then authorization is delegated to Ranger to provide fine-grained data access control in Hive, including row-level filtering and column-level masking. This is the recommended setting to make your database administration easier as it provides a centralized security administration, access control, and detailed auditing for user access within the Hadoop, Hive, HBase, and other components in the ecosystem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, I had already enabled the Ranger plugin for hive on my cluster but all the same, it confirms what I wrote above. Once the ranger plugin is enabled for a component ie. hive,HBase or Kafka then the authorization is managed exclusively through Ranger&lt;BR /&gt;&lt;BR /&gt;Database listing before Ranger&lt;BR /&gt;Below is what happens if my user &lt;FONT color="#FF6600"&gt;sheltong&lt;/FONT&gt; has not explicitly been given authorization through Ranger, see [screenshots]&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="01.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29995i2DEE1205E6157E08/image-size/large?v=v2&amp;amp;px=999" role="button" title="01.JPG" alt="01.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I see no database though I have over 8 databases&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="02.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29996i6CF09C42765D7A4B/image-size/large?v=v2&amp;amp;px=999" role="button" title="02.JPG" alt="02.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;See the output of the hive user who has explicit access to all the tables due to the default policy he could see the databases.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="04.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30002iD812293FAC641EC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="04.JPG" alt="04.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Database listing after Ranger&lt;/P&gt;&lt;P&gt;After creating a policy explicitly giving the user &lt;FONT color="#FF6600"&gt;sheltong&lt;/FONT&gt; access to the 3 databases&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="03.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29997iC5F88443E0C2244F/image-size/large?v=v2&amp;amp;px=999" role="button" title="03.JPG" alt="03.JPG" /&gt;&lt;/span&gt;&lt;BR /&gt;Policy granting explicit access to 3 databases&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="05.JPG" style="width: 838px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29998i89E9124641889D70/image-size/large?v=v2&amp;amp;px=999" role="button" title="05.JPG" alt="05.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now when I re-run the show databases bingo!&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="06.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29999i7B1191EC9B84F871/image-size/large?v=v2&amp;amp;px=999" role="button" title="06.JPG" alt="06.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Back to your question show tables from forbidden_db, it returns an empty list, this can be true especially if the database is empty! has not table like the screenshot below though I have access to the database it's empty&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="07.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30000i20970885BF59E2BF/image-size/large?v=v2&amp;amp;px=999" role="button" title="07.JPG" alt="07.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now I create a table and re-run the select now I am able to see the table&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="08.JPG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30001iB9AC465A951F020C/image-size/large?v=v2&amp;amp;px=999" role="button" title="08.JPG" alt="08.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I hope this demonstrates the power of Ranger and explains maybe what you are encountering, I am also thinking if your cluster has Ranger hive plugin enabled you could have &lt;FONT color="#FF6600"&gt;select&lt;/FONT&gt; on the databases but you will need explicit minimum &lt;FONT color="#FF6600"&gt;select&lt;/FONT&gt;&amp;nbsp;or the following permission on the underlying database&amp;nbsp; tables to be able to see them.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="09.JPG" style="width: 759px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30003iAD3ED73E29805D21/image-size/large?v=v2&amp;amp;px=999" role="button" title="09.JPG" alt="09.JPG" /&gt;&lt;/span&gt;&lt;BR /&gt;Happy Hadooping&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2021 20:44:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-list-all-Hive-databases-that-I-have-access-to/m-p/308616#M223634</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2021-01-03T20:44:47Z</dc:date>
    </item>
  </channel>
</rss>

