title: Hadoop Hive: How to allow regular user continuously write data and create tables in warehouse directory?
body: <p>I am running Hadoop 2.2.0.2.0.6.0-101 on a single node.
  I am trying to run Java MRD program that writes data to an existing Hive table from Eclipse under regular user. I get exception:</p>
  
  <pre><code>org.apache.hadoop.security.AccessControlException: Permission denied: user=dev, access=WRITE, inode="/apps/hive/warehouse/testids":hdfs:hdfs:drwxr-xr-x
  </code></pre>
  
  <p>This happens because regular user has no write permission to warehouse directory, only <code>hdfs</code> user does:</p>
  
  <pre><code>drwxr-xr-x   - hdfs hdfs          0 2014-03-06 16:08 /apps/hive/warehouse/testids
  drwxr-xr-x   - hdfs hdfs          0 2014-03-05 12:07 /apps/hive/warehouse/test
  </code></pre>
  
  <p>To circumvent this I change permissions on warehouse directory, so everybody now have write permissions:</p>
  
  <pre><code>[hdfs@localhost wks]$ hadoop fs -chmod -R a+w /apps/hive/warehouse
  [hdfs@localhost wks]$ hadoop fs -ls /apps/hive/warehouse
  drwxrwxrwx   - hdfs hdfs          0 2014-03-06 16:08 /apps/hive/warehouse/testids
  drwxrwxrwx   - hdfs hdfs          0 2014-03-05 12:07 /apps/hive/warehouse/test
  </code></pre>
  
  <p>This helps to some extent, and MRD program can now write as a regular user to warehouse directory, but only once. When trying to write data into the same table second time I get:</p>
  
  <pre><code>ERROR security.UserGroupInformation: PriviledgedActionException as:dev (auth:SIMPLE) cause:org.apache.hcatalog.common.HCatException : 2003 : Non-partitioned table already contains data : default.testids
  </code></pre>
  
  <p>Now, if I delete output table and create it anew in <code>hive</code> shell, I again get default permissions that do not allow regular user to write data into this table:</p>
  
  <pre><code>[hdfs@localhost wks]$ hadoop fs -ls /apps/hive/warehouse
  drwxr-xr-x   - hdfs hdfs          0 2014-03-11 12:19 /apps/hive/warehouse/testids
  drwxrwxrwx   - hdfs hdfs          0 2014-03-05 12:07 /apps/hive/warehouse/test
  </code></pre>
  
  <p>Please advise on Hive correct configuration steps that will allow a program run as a regular user do the following operations in Hive warehouse:</p>
  
  <ul>
  <li>Programmatically create / delete / rename Hive tables? </li>
  <li>Programmatically read / write data from Hive tables?</li>
  </ul>
  
  <p>Many thanks!</p>