User Identification

Gerhard Haering gh at ghaering.de
Tue Feb 8 08:18:27 EST 2005


On Tue, Feb 08, 2005 at 12:29:48PM -0000, Bob Parnes wrote:
> I have a python program on a server of an all-linux network. It needs to 
> record the user name running it. Is there a way for the program to extract
> the name from the system without a separate log-in dialog?

os.environ["USER"] for a start?

os.getuid() will give you the user id, but I don't know if Python has
methods to look up more information from that from /etc/passwd or
whereever from.

-- Gerhard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20050208/aec2467f/attachment.sig>


More information about the Python-list mailing list