Pages

Saturday, November 29, 2014

User Management

useradd -u <UID> -g'<grp_name>' -c "User_Info" -d /home/<uname> <uname>

chage -l <uname>

root@testServer# chage -l <uname>
Last password change                                    : Jun 27, 2014
Password expires                                        : Sep 25, 2014
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 90
Number of days of warning before password expires       : 7

root@testServer# chage -E -1 <uname>
root@testServer# chage -m 0 <uname>
root@testServer# chage -M 99999 <uname>

root@testServer # chage -l <uname>
Last password change                                    : Jun 27, 2014
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7

root@testServer # chage -m 5 -M 90 -W 14 <uname>
root@testServer# chage -l <uname>
Last password change                                    : Jul 29, 2014
Password expires                                        : Oct 27, 2014
Password inactive                                       : Nov 26, 2014
Account expires                                         : never
Minimum number of days between password change          : 5
Maximum number of days between password change          : 90
Number of days of warning before password expires       : 14

root@testServer# chage -I 30 <uname>

root@testServer# chage -l <uname>
Last password change                                    : Jul 29, 2014
Password expires                                        : Oct 27, 2014
Password inactive                                       : Nov 26, 2014
Account expires                                         : never
Minimum number of days between password change          : 5
Maximum number of days between password change          : 90
Number of days of warning before password expires       : 14

Renaming user accounts
usermod -l new_username old_username

Change user ID:
usermod -u UID username

groupadd -g GID <grp_name>
useradd -G {group-name} username

useradd -g GID <user_name>

usermod -a -G sysman <uname>
(-a to append to current list of groups)
(-G to add as secondary)
(-g to add as primary)

How Do I Find Out My Primary Group Membership?

[root@redhat home]# getent group uname
uname:x:500:
root@redhat home]# id -Gn
root
[root@redhatt home]# id -Gn uname
uname sysman

Delete user
userdel --remove <user_name>

################################################################

E = Expiry date 
(Passing the number -1 as the EXPIRE_DATE will remove an account expiration date) 
d = Last Day
l= Show account aging information
m = A value of zero for this field indicates that the user may change his/her password at any time.
M = Passing the number -1 as MAX_DAYS will remove checking a password's validity.

No comments:

Post a Comment