Created 06-27-2018 10:24 AM
Hi Team,
I have a table called 'test' and its owner is 'ben', I need to change the ownership of the same table from 'ben' to 'sam' and i don't have login access to sam.
How can i achieve this , Is there any possibility to change the ownership or is there any command to change the ownership
Regards,
Mathivanan
Created 06-27-2018 11:46 PM
Hey @Mathi Murugan!
Hm, could you share with us more details? Is your environment secure (kerberos, ranger, knox, hdfs acl)?
If it isn't, then try to add permission to your user through chmod (to have write/read permissions) or take the ownership through chown, would be smtg like this:
hdfs dfs -chmod - R 777 /apps/hive/warehouse/salaries --TABLE SALARIESJust remember that you'll need to run these commands as hdfs user or have the same permission as hdfs.
hdfs dfs -chown -R hive:hadoop /apps/hive/warehouse/salaries --Changing the ownership from root to hive
Hope this helps!
Created 08-24-2018 05:33 AM
Hdfs chown command would be ok, but Hive meta also maintains owner information such as tbls.owner in mysql. I think it is better to use Hive command if provided.
Created 08-24-2018 09:03 AM
I see that currently ALTER (DATABASE|SCHEMA) database_name SET OWNER [USER|ROLE] user_or_role; does not give the desired fine-grained option for only a specific table in a schema/database, so I think the best option would be to use Ranger and give a select privilege on the particular database or underlying table to the new user who can then issue a Create Table As Select (CTAS) which will automatically change the ownership to the issuer of the CTAS.
HTH