User and User Group
Below are the default UID and shell for users in RHEL-7
User | UID | Shell |
Admin | 0 | /bin/bash |
System | 1-999 | /bin/nologin |
Regular | 1000 + | /bin/bash |
- Whenever a user is created be default it belongs to its own group.
- At creation, new user gets its default directories and files from /etc/skel
- Default password length, expiry, GID, UID range etc. is stored in /etc/login.defs
- /etc/passwd (user information, UID etc)
- /etc/group (group information, GID, associated user etc.)
- /etc/shadow (User password, expiry etc.)
- To add/edit new user & group
# adduser <user>
# useradd <user>
# useradd -g <group> <user> //force use GROUP as new primary group
# useradd -u <UID> <user> //Add user with specific unique UID
# groupadd <group>
# usermod -aG <group1>,<group2>,<group3> <user> //to assign multiple group to user
# usermod -G ‘ ’ <user> //remove all group
# usermod -s <shell> <user> //to change shell
# gpasswd -a <user> <group> //add user in new group without removing from other.
# chage -l //view user details from /etc/shadow
# chage -m //modify user days etc.