The pythonic way equal to "whoami"

Nitin Pawar nitinpawar432 at gmail.com
Tue Jun 7 10:52:15 EDT 2011


import getpass

user = getpass.getuser()

On Tue, Jun 7, 2011 at 7:54 PM, TheSaint <nobody at 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?
> --
> goto /dev/null
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Nitin Pawar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110607/8edea043/attachment-0001.html>


More information about the Python-list mailing list