User and Groups
Show real and effective user and group IDs
id
Show last logged users
last
Verifies the integrity of the users and authentication information.
pwck
Verifies the integrity of the groups information.
newgrp
Change shell of user
chsh
Show password expiration date
chage -l <user_name>
Restricted Shells
useadd <user name> –s /bin/rbash
mkdir –p /home/<user name>/bin
cp /bin/ping /home/<user name>/bin
ln –s /bin/ls /home/<user name>/bin
Create a user with defaul group and add him to other group.
useradd -m -N -g primary_group -G other_group user_name
Create system user
useradd --system --no-create-home -s /sbin/nologin user_name
Delete user
userdel <user name>
userdel –rf <user name>
Create group
groupadd group_name
Delete group
delgroup group_name
Make the default group
usermod -g group_name user_name
Add to the group
usermod -a -G group_name user_name
Remove user from group
usermod -R group_name user_name