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.

User unique ID

Discussion in 'cPanel Developers' started by guiligan, Apr 16, 2010.

  1. guiligan

    guiligan Registered

    Joined:
    Apr 16, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I searched all around but couldn't find the answer. Does cPanel creates a Unique user id that never changes for each user? If so, how can I retrieve it? If not, how is the best way to make this?

    I'm trying to integrate some of my site systems with cPanel for each user.

    Thank you in advance,
    Guilherme Mori
     
    #1 guiligan, Apr 16, 2010
    Last edited: Apr 17, 2010
  2. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    France
    cPanel Access Level:
    Root Administrator
    You can fetch usernames, userids and groupids from /etc/passwd :)
     
  3. guiligan

    guiligan Registered

    Joined:
    Apr 16, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hey yapluka, thanks for answering!
    On passwd i have something like this
    user:x:512:512::/path:/another/path
    the first number is userid and the second is groupid?
    And is there a way the get this using the cPanel API?

    Thank you,
    Guilherme Mori
     
  4. guiligan

    guiligan Registered

    Joined:
    Apr 16, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Ok, managed to get the info using the passwd. Can someone tell me which number is the userid?

    thank you!
     
  5. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    The first number is the UID.

    if the process is already running as the user (php under suphp, suexec cgi, cpanel) you can always use "getpwuid" which is available in both php and perl.
     
Loading...

Share This Page