Get UID of username

Gary Herron gherron at
Mon Jan 5 18:26:14 CET 2004

On Monday 05 January 2004 09:20 am, Florian Lindner wrote:
> Hello,
> how can I find out the UID of a username on a linux system?
> Thx,
> Florian

Try the pwd module:

>>> import pwd
>>> pwd.getpwnam('gjh')
('gjh', 'x', 500, 500, 'Gary Herron', '/home/gjh', '/bin/bash')

Gary Herron

More information about the Python-list mailing list