ebuka

Member
Oct 26, 2018
20
3
3
Nigeria
cPanel Access Level
Root Administrator
Good Day happy people.
Please I have been trying to get the server backup-disk space from a cpanel account with the below php code, but I keep getting error:
code:
$df = disk_free_space("/backup");
echo $df;

Error:
PHP Warning: disk_free_space(): No such file or directory in /home/username/public_html/test.php on line 137

I have added the cpanel user to the root group(I have root previlage ), the "/backup" drive permission is 0771 and the user can execute exec() command.

Kindly help.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
I have added the cpanel user to the root group(I have root previlage ),
Hello @ebuka,

This is not a recommended action due to the negative security impact.

Can you provide some more background information about the need for this functionality? Particularly, what's the use case for providing the cPanel user with the ability to see how much space is available on the /backup partition?

Note the following UAPI function is available to obtain account-specific resource usage:

UAPI Functions - ResourceUsage::get_usages - Developer Documentation - cPanel Documentation

Thank you.
 

ebuka

Member
Oct 26, 2018
20
3
3
Nigeria
cPanel Access Level
Root Administrator
Hello @ebuka,

This is not a recommended action due to the negative security impact.

Can you provide some more background information about the need for this functionality? Particularly, what's the use care for providing the cPanel user with the ability to see how much space is available on the /backup partition?

Note the following UAPI function is available to obtain account-specific resource usage:

UAPI Functions - ResourceUsage::get_usages - Developer Documentation - cPanel Documentation

Thank you.
Thanks for your response.
We have several severs that their backup diskspace fills-up easily due to their size. The management is not ready to upgrade the backup diskspace, so most time we only get to know the disk is filled-up when we try to restore an account from back-up and a diskspace error comes up. In essence, I want to get the backup disk value s from all our servers and display all of them on a single page.

P.S Thanks for the UAPI function reference, but my focus is on the backup disk value for the whole server not users.
 

ebuka

Member
Oct 26, 2018
20
3
3
Nigeria
cPanel Access Level
Root Administrator
Thank your Sir for your guide and sorry for getting back late. The WHM API will bring in additional over head which I am trying to avoid.
I just want to access the server backup disk space value from a cpanel user domain. Some thing like www.domain.com/backupspace.php
Also is it possible to call "Server Information"(see attached file) page from a cpanel user script since the page provides the server disk-space but requires logining in to cpanel.
Thanks
 

Attachments