By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,930 Members | 2,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,930 IT Pros & Developers. It's quick & easy.

find login name of user?

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

-ishwar

Dec 30 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a

<ra****@cps.cmich.eduwrote in message
news:11**********************@v33g2000cwv.googlegr oups.com...
Is there a function/module to find the login name of the user under
UNIX environment?
who
who am i
finger
id
Dec 30 '06 #2

P: n/a

karel wrote:
<ra****@cps.cmich.eduwrote in message
news:11**********************@v33g2000cwv.googlegr oups.com...
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 '06 #3

P: n/a
ra****@cps.cmich.edu schrieb:
Is there a function/module to find the login name of the user under
UNIX environment?

http://docs.python.org/lib/os-procinfo.html

http://docs.python.org/lib/module-pwd.html
Dec 30 '06 #4

P: n/a

<ra****@cps.cmich.eduwrote in message
news:11**********************@s34g2000cwa.googlegr oups.com...
>
karel wrote:
><ra****@cps.cmich.eduwrote in message
news:11**********************@v33g2000cwv.googleg roups.com...
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.
Dec 30 '06 #5

P: n/a
Uwe Hoffmann wrote:
ra****@cps.cmich.edu schrieb:
>Is there a function/module to find the login name of the user under
UNIX environment?


http://docs.python.org/lib/os-procinfo.html

http://docs.python.org/lib/module-pwd.html
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?

--
mph
Dec 30 '06 #6

P: n/a
In message <11**********************@v33g2000cwv.googlegroups .com>,
ra****@cps.cmich.edu 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.
Dec 31 '06 #7

P: n/a
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
Jan 1 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.