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.

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

Discussion in 'cPanel Developers' started by sh33pz, Feb 15, 2013.

  1. sh33pz

    sh33pz Registered

    Joined:
    Aug 28, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    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?
     
  2. morissette

    morissette Well-Known Member

    Joined:
    May 24, 2009
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Austin, TX
    cPanel Access Level:
    Root Administrator
  3. sh33pz

    sh33pz Registered

    Joined:
    Aug 28, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
  4. morissette

    morissette Well-Known Member

    Joined:
    May 24, 2009
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    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');
    }
     
Loading...

Share This Page