User ADM - Admin operations

terça-feira, 27 de dezembro de 2011

Create a new user


# useradd -m -s /usr/bin/ksh -g primary_group -G seconday_group user
(just the user name is mandatory)
Change the secondary group of a user

# usermod -G secondary_group user

Change the primary group of a user

# usermod -g primary_group user

Removing a user

# userdel user
# userdel -r user
(Remove the home directory too)

Create a new group

# groupadd group

Changing a group name

# groupmod -n groupname newgroupname

Command to remove a group

# groupdel groupname

Check integrity of /etc/passwd

# pwck

Check integrity of  /etc/group

# grpck

changing a user passwd

# passwd user

Setting a null password for a user

# passwd -d user

Force to change the passwd in the next login

# passwd -f user

Lock a user account

# passwd -l user
or
# /usr/lbin/modprpw -l -x user

Unlock a user account

# passwd -u user
or
# /usr/lbin/modprpw -l -k user

Passwd reset

# /usr/lbin/modprpw -x user

Reset passwd age

# /usr/lbin/modprpw -v user