Getting User and Group Information
The pwd module
- Provides access to the Unix password database
pwd.getpwuid(uid) # Returns passwd entry for uid
pwd.getpwname(login) # Returns passwd entry for login
pwd.getpwall() # Get all entries
x = pwd.getpwnam('beazley')
# x = ('beazley','x',100,1,'David M. Beazley', '/home/beazley',
# '/usr/bin/csh')
The grp module
|