Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

user permission for ambari-server

Tags:

linux

sudo

ambari

How can I grant permissions to specific users to run ambari-server? Currently, I get

mahmood@cluster:~$ ambari-server
/usr/sbin/ambari-server: line 47: /var/lib/ambari-server/ambari-env.sh: Permission denied
Using python  /usr/bin/python
Usage:
    {start|stop|restart|setup|setup-jce|upgrade|status|upgradestack|setup-ldap|sync-ldap|set-current|setup-security|setup-sso|refresh-stack-hash|backup|restore|update-host-names|check-database|db-cleanup|enable-stack}  [options]
    Use  <action> --help to get details on options available.
    Or, simply invoke ambari-server.py --help to print the options.
like image 873
mahmood Avatar asked Dec 19 '25 05:12

mahmood


1 Answers

Ambari by default is installed for root. Thus you must run it as root. This can be achieved in several ways. I will explain the best way (in my opinion) to do this using sudo.

Overview:

  • Create a group and gives its users permissions to use the ambari-server command. For this example we will create a group with the name of 'ambari'.

Steps:

  1. Create the group sudo groupadd ambari
  2. Grant the group permission to run the command using visudo. Run sudo visudo and add ONE of the following lines to the end of the file:

    %ambari ALL=(ALL) NOPASSWD: /usr/sbin/ambari-server

    or

    %ambari ALL=(ALL) /usr/sbin/ambari-server

    Note: The first option will not require the user to type their password to execute the command. The second option will require them to do so.

  3. Add the appropriate users to the group (eg. joe)

    sudo usermod -aG ambari joe

  4. Those users in the ambari group can now execute sudo ambari-server start

like image 177
cjackson Avatar answered Dec 20 '25 21:12

cjackson