Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7158

Re: The pythonic way equal to "whoami"

References <islca0$asr$1@speranza.aioe.org>
From Kushal Kumaran <kushal.kumaran+python@gmail.com>
Date 2011-06-07 20:29 +0530
Subject Re: The pythonic way equal to "whoami"
Newsgroups comp.lang.python
Message-ID <mailman.2533.1307458768.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Jun 7, 2011 at 7:54 PM, TheSaint <nobody@nowhere.net.no> wrote:
> Hello,
> I was trying to find out whose the program launcher, but os.environ['USER']
> returns the user whom owns the desktop environment, regardless the program
> is called by root.
> I'd like to know it, so the program will run with the right privileges.
>
> Is there any standard function on python, that will do it?

os.geteuid

You should consider using the access control mechanisms provided by
your OS to do this, though.  If your program is readable by
unauthorized users, they can simply make a copy, and change as
desired.

-- 
regards,
kushal

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

The pythonic way equal to "whoami" TheSaint <nobody@nowhere.net.no> - 2011-06-07 22:24 +0800
  Re: The pythonic way equal to "whoami" Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2011-06-07 20:29 +0530
    Re: The pythonic way equal to "whoami" TheSaint <nobody@nowhere.net.no> - 2011-06-08 21:58 +0800
      Re: The pythonic way equal to "whoami" Christopher Head <chead@is.invalid> - 2011-06-08 13:08 -0700
        Re: The pythonic way equal to "whoami" TheSaint <nobody@nowhere.net.no> - 2011-06-09 19:34 +0800
      Re: The pythonic way equal to "whoami" Nobody <nobody@nowhere.com> - 2011-06-09 03:38 +0100

csiph-web