Re: The pythonic way equal to "whoami"

2011-06-09 Thread TheSaint
Christopher Head wrote: > It is. Until Linux capabilities, EUID==0 used to be special-cased in the > kernel Thank you all, I got a good learning *and* something to rememeber. -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: The pythonic way equal to "whoami"

2011-06-08 Thread Cameron Simpson
On 07Jun2011 20:22, Nitin Pawar wrote: | import getpass | user = getpass.getuser() | | On Tue, Jun 7, 2011 at 7:54 PM, TheSaint wrote: | > 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 |

Re: The pythonic way equal to "whoami"

2011-06-08 Thread Nobody
On Wed, 08 Jun 2011 21:58:17 +0800, TheSaint wrote: >> os.geteuid > This return 0 for *root* . I don't know if it's a standard for all distro. UID 0 is the "superuser". The name "root" is conventional, but it's the EUID (effective UID) which is used in permission checks; the kernel doesn't care a

Re: The pythonic way equal to "whoami"

2011-06-08 Thread Christopher Head
On Wed, 08 Jun 2011 21:58:17 +0800 TheSaint wrote: > Kushal Kumaran wrote: > > > os.geteuid > This return 0 for *root* . I don't know if it's a standard for all > distro. Mine is Archlinux. > I'd just like to avoid error caused by wrong access by user > It is. Until Linux capabilities, EUID==0

Re: The pythonic way equal to "whoami"

2011-06-08 Thread TheSaint
Kushal Kumaran wrote: > os.geteuid This return 0 for *root* . I don't know if it's a standard for all distro. Mine is Archlinux. I'd just like to avoid error caused by wrong access by user -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: The pythonic way equal to "whoami"

2011-06-07 Thread Kushal Kumaran
On Tue, Jun 7, 2011 at 7:54 PM, TheSaint 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 pri

Re: The pythonic way equal to "whoami"

2011-06-07 Thread Nitin Pawar
import getpass user = getpass.getuser() On Tue, Jun 7, 2011 at 7:54 PM, TheSaint 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,

The pythonic way equal to "whoami"

2011-06-07 Thread TheSaint
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