Getting list of cpanel users using PHP CLI to display within WHM plugin

sh33pz

Registered
Aug 28, 2007
3
0
51
Hello,

I am assuming, one can just, cat /etc/passwd for users and then check to see if they are in the /var/cpanel/users
dir? Or is there a better way?
 

morissette

Well-Known Member
May 24, 2009
119
2
66
Austin, TX
cPanel Access Level
Root Administrator
This is perl but I'm sure you can do the same with PHP to check if access hash exists and then make one if it doesnt.

if ( ! -f '/root/.accesshash' ) {
$ENV{REMOTE_USER} = 'root';
system('/usr/local/cpanel/bin/realmkaccesshash');
}