User / Groups
Multi-User Operating Systems
An operating system is considered as multi-user if it allows multiple people/users to use a computer and not affect each other's files and preferences. Linux based operating systems are multi-user in nature.
User/Group Management
Users in Linux has an associated user ID called UID attached to them.
A group is a collection of one or more users.
A group makes it easier to share permissions among a group of users.
Each group has a group ID called GID associated with it.
id command
id
command can be used to find the uid and gid associated with an user. It also lists down the groups to which the user belongs to.
The uid and gid associated with the root user is 0.
A good way to find out the current user in Linux is to use the whoami command.
"root" user or superuser is the most privileged user with unrestricted access to all the resources on the system. It has UID 0
Important files associated with users/groups
Important commands for managing users
Some of the commands which are used frequently to manage users/groups on Linux are following:
useradd
- Creates a new userpasswd
- Adds or modifies passwords for a userusermod
- Modifies attributes of a user (like home directory or shell)One easy way of providing root access to users is to add them to a group which has permissions to run all the commands. "wheel" is a group in redhat Linux with such privileges.
usermod -a -G wheel <user>
userdel
- Deletes a usersu
- Switch user
Important commands for managing groups
Last updated