Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED API bash authentication.

Discussion in 'cPanel Developers' started by arjene, Nov 14, 2017.

  1. arjene

    arjene Member
    PartnerNOC

    Joined:
    Jan 23, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    When using whmapi1 to set all account to the shared ipv6 adres. (cpanel assigns only the shared ipv4 adres tot the vhost) i use this bash script:

    Code:
    --
    #!/bin/bash
    #
    
    /bin/ls -1 /var/cpanel/users | while read USER; do
      /bin/echo "Now processing ${USER} ..."
    /usr/sbin/whmapi1 --user=${USER} ipv6_enable_account range=SHARED
    
    --
    error:
    metadata:
      command: ipv6_enable_account
      reason: "Permission denied: You do not have the required privileges to run “ipv6_enable_account”."
      result: 0
      version: 1
    ---
    
    How do i use the api authentication from the command line ?

    Regards.

    Arjen
     
    #1 arjene, Nov 14, 2017
    Last edited by a moderator: Nov 14, 2017
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,553
    Likes Received:
    40
    Trophy Points:
    308
    cPanel Access Level:
    Root Administrator
    The --user parameter instructs the API tool to perform the action as the specified user. What you want instead is username, which instructs the API tool which user to act on.

    Example:

    Code:
    /bin/ls -1 /var/cpanel/users | while read USER; do
        /bin/echo "Now processing ${USER} ..."
        /usr/sbin/whmapi1 ipv6_enable_account username=${USER} range=SHARED;
    done
     
    arjene likes this.
  3. arjene

    arjene Member
    PartnerNOC

    Joined:
    Jan 23, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Kenneth, thanks for your input.

    changed username to user and it's working:

    Code:
    #!/bin/bash
    #
    /bin/ls -1 /var/cpanel/users | while read USER; do
        /bin/echo "Now processing ${USER} ..."
        /usr/sbin/whmapi1 ipv6_enable_account user=${USER} range=SHARED;
    done
    
     
Loading...

Share This Page