getting current UNIX uid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Johhny

    #1

    getting current UNIX uid

    Hello,

    I am trying to get the user that is running the scripts uid, I have had
    a look at the pwd module and it does not appear to offer that
    functionality. Is there any way within python to get that information ?

    Regards,

    Johhny

  • Eric Deveaud

    #2
    Re: getting current UNIX uid

    Johhny wrote:
    Hello,
    >
    I am trying to get the user that is running the scripts uid, I have had
    a look at the pwd module and it does not appear to offer that
    functionality. Is there any way within python to get that information ?
    eg:
    username = pwd.getpwuid(os .getuid())[4]

    Eric

    Comment

    • Richie Hindle

      #3
      Re: getting current UNIX uid


      [Johhny]
      I am trying to get the user that is running the scripts uid, I have had
      a look at the pwd module and it does not appear to offer that
      functionality. Is there any way within python to get that information ?
      It's in the 'os' module:
      >>import os
      >>os.getuid()
      553

      --
      Richie Hindle
      richie@entrian. com

      Comment

      Working...