Thursday, January 10, 2013

Displays user account attributes


Have you ever thought of checking all the attributes of a specific user in your AIX machine?
If your answer is Yes, then this quick documentation is awesome for you!
If your answer is No, then it is Also for you ;-)

Anyways, there is a command called lsuser
that could use you to get as much as info about a user.
Of course there are many other commands that would help you to achieve the same goal like the command id .



1st of all, let me tell you how awesome is the command lsuser. Depends of the options that you write with this command it goes and retrieve info from the below files:
/etc/passwd
/etc/security/user
/etc/security/user.roles
/etc/security/limits
/etc/security/environ
/etc/group
/etc/security/audit/config
/etc/security/enc/LabelEncodings


Now, let me show you some examples of the usage of this command that you may meet in your daily administration tasks:
NOTE: you must be authorized user or have root authorization to run this command.


-To list all the users in your systems and all the attributes:
#lsuser ALL 




 
-To list all the attributes of specific user (e.g. the user root):
#lsuser root



-To display(in stanza form) the user id and group-related information about the root account:
#lsuser -f -a id pgrp groups admgroups root


 
-To display(in colon form) the user id and group-related information about the root account:
#lsuser -c -a id pgrp groups admgroups root



NOTE: displaying in stanza and colon is very helpful and beneficial in shell scripting.


-To display the time of the last login of all the users in your machine:
 #lsuser -a time_last_login ALL




-To check all the home directory of All the users in your machine:
#lsuser a home ALL

 
-Identifies the expiration date of the account.
#lsuser -a expires ALL

The Value parameter is a 10-character string in the MMDDhhmmyy form, where MM = month, DD = day, hh = hour, mm = minute, and yy = last 2 digits of the years 1939 through 2038.
And the Value Zero means there is no expiration date.




-Indicates if the user account is locked.
(True means it is locked and false means the user account is not locked)
#lsuser -a account_locked ALL





Actually, there are many many other attributes .I will write down other blogs later to show you how to get more information about the user attributes!



No comments:

Post a Comment