FAQ - How do I run asadm that require enable permissions from the command line?

FAQ: How do I run asadm that require enable permissions from the command line?

Detail

On newer versions of asadm, certain commands require you to escalate your privileges up to enable level before they can be run. If doing this from within asadm, you simply type enable and you can then run the required command, but if you run it from the command line you will not get the opportunity to escalate privileges to enable mode, resulting in the following error:

$ asadm -e "asinfo -v 'set-config:context=namespace;id=test;enable-benchmarks-read=true'"
Seed:        [('127.0.0.1', 3000, None)]
Config_file: /root/.aerospike/astools.conf, /etc/aerospike/astools.conf
ERROR: User must be in privileged mode to issue "asinfo" commands.
       Type "enable" to enter privileged mode.

Answer

You can switch to enable mode from the command line by prepending your asinfo command with enable:

$ asadm -e "enable;asinfo -v 'set-config:context=namespace;id=test;enable-benchmarks-read=true'"
Seed:        [('127.0.0.1', 3000, None)]
Config_file: /root/.aerospike/astools.conf, /etc/aerospike/astools.conf

~~~ enable ~~~

~~~ asinfo -v 'set-config:context=namespace;id=test;enable-benchmarks-read=true' ~~~
a0139619a5bb:3000 (172.17.0.3) returned:
ok

Keywords

ASADM ENABLE COMMAND LINE CLI ASINFO

Timestamp

September 2021

© 2021 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.