AJ84
AJ84

Reputation: 175

Unable to run hive command from another user on Ubuntu

I have installed Apache Hive as hduser and am able to run that perfectly from my hduser.

I want to run that as command hive -f someScript.sql but I want to do that from some other user, say root. I am trying a command like

sudo -u hduser '/usr/local/hive/bin/hive -f test.sql'

The output I am getting is

sudo: /usr/local/hive/bin/hive -f test.sql: command not found

I have my user hduser in the list of sudoers as well if that helps. I don't understand why this could be happening since hive has been properly added to the path and when I go via su hduser and then run it, this all works fine.

Upvotes: 0

Views: 2008

Answers (2)

Sai Neelakantam
Sai Neelakantam

Reputation: 939

Syntax of your command is incorrect. See this:

sudo -u hduser /usr/local/hive/bin/hive -f test.sql

Make sure that hduser has the read access to your test.sql file.

Upvotes: 2

Amar
Amar

Reputation: 3845

I think your syntax is not correct (you are putting the entire query in quotes). Try this:

sudo -u hduser /usr/local/hive/bin/hive -f 'test.sql'

Upvotes: 1

Related Questions