find login name of user?

Discussion in 'Python' started by rattan@cps.cmich.edu, Dec 30, 2006.

  1. Guest

    Is there a function/module to find the login name of the user under
    UNIX environment?

    -ishwar
    , Dec 30, 2006
    #1
    1. Advertising

  2. karel Guest

    <> wrote in message
    news:...
    > Is there a function/module to find the login name of the user under
    > UNIX environment?


    who
    who am i
    finger
    id
    karel, Dec 30, 2006
    #2
    1. Advertising

  3. Guest

    karel wrote:
    > <> wrote in message
    > news:...
    > > Is there a function/module to find the login name of the user under
    > > UNIX environment?

    >
    > who
    > who am i
    > finger
    > id


    I was talking about under python environment.

    -ishwar
    , Dec 30, 2006
    #3
  4. karel Guest

    <> wrote in message
    news:...
    >
    > karel wrote:
    >> <> wrote in message
    >> news:...
    >> > Is there a function/module to find the login name of the user under
    >> > UNIX environment?

    >>
    >> who
    >> who am i
    >> finger
    >> id

    >
    > I was talking about under python environment.


    Ah! Thanks for enlightening me.
    Apologies for misunderstanding.
    karel, Dec 30, 2006
    #4
  5. Uwe Hoffmann Guest

    Uwe Hoffmann, Dec 30, 2006
    #5
  6. Martin P. Hellwig, Dec 30, 2006
    #6
  7. In message <>,
    wrote:

    > Is there a function/module to find the login name of the user under
    > UNIX environment?


    Note that there isn't really an important concept of "login name" under *NIX
    systems. There is the current process UID and GID, effective UID and GID
    and so on, but these are just numbers, not names.

    The OS doesn't remember anywhere the actual name that you used to login
    with; this is conventionally saved in the USER environment variable, but
    this is purely for informational purposes.
    Lawrence D'Oliveiro, Dec 31, 2006
    #7
  8. Brian Beck Guest

    Martin P. Hellwig wrote:
    > Speaking of that, is there any reason why there isn't any syntactic
    > sugar that gives the illusion of platform neutral fetching of the user
    > name?


    getpass.getuser() might come the closest:
    http://docs.python.org/lib/module-getpass.html

    --
    Brian Beck
    Adventurer of the First Order
    Brian Beck, Jan 1, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William F. Robertson, Jr.
    Replies:
    0
    Views:
    430
    William F. Robertson, Jr.
    Jul 2, 2003
  2. nalbayo
    Replies:
    2
    Views:
    5,478
    Bruce Barker
    Nov 11, 2005
  3. sumi
    Replies:
    7
    Views:
    284
    Jorgen Grahn
    Nov 9, 2005
  4. Tony Johansson
    Replies:
    3
    Views:
    16,116
    Patrice
    Jan 2, 2010
  5. Antonio O''Neal

    user.identity.name returns old AD user name

    Antonio O''Neal, Oct 31, 2008, in forum: ASP .Net Security
    Replies:
    5
    Views:
    2,040
    Antonio O''Neal
    Nov 3, 2008
Loading...

Share This Page