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!

Listing accounts on mount points via API

Discussion in 'cPanel Developers' started by DriveSafe, Feb 25, 2019.

  1. DriveSafe

    DriveSafe Registered

    Joined:
    Apr 11, 2016
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Newmarket, Ontario
    cPanel Access Level:
    Root Administrator
    Hi,

    I have been looking to find a way to get a list of accounts on the various mount points. Account summary or list accounts give partition, but it's the least of what I need.

    The file system is /mnt/cpuser1/acctname, /mnt/cpuser2/acctname, etc. Partition only gives "mnt". I know that I can use a bash script to get the various account names and then feed them to the API, but that seems like the clunky way. The information is available in the rearrange-account functionality of the WHM, but I can't even find the script for that page on the server to help me.

    Hope someone has some info...

    Thanks in advance,
    Steve
     
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,459
    Likes Received:
    503
    Trophy Points:
    263
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @DriveSafe

    There's no whmapi1 that will do this but you could essentially use the quota command for this, though you'd have to loop through all the users:

    Code:
    [[email protected] ~]# quota -u lauren
    Disk quotas for user lauren (uid 1000):
         Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
          /dev/vda1 1764100  10485760 10485760           41054       0       0
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. DriveSafe

    DriveSafe Registered

    Joined:
    Apr 11, 2016
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Newmarket, Ontario
    cPanel Access Level:
    Root Administrator
    Thanks, Lauren.

    i ended up using this inside of the listaccts loop:
    exec('getent passwd '.$userdetails->{'user'}.' | cut -d: -f6 | cut -d/ -f3')
     
    cPanelLauren likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice