Linux User and Group Commands Every Beginner Should Know ๐ฉโ๐ป- Day 5/90
๐จโ๐ผ Users in Linux
In Linux, users are the stars of the show. Each user gets a special username and a unique User ID (UID). Think of the UID as their backstage pass to the system, enabling it to distinguish one user from another. When a user logs in, they step into their own world of permissions and settings, defining what they can and cannot do on the system. ๐
Key user-related concepts in Linux:
๐ Usernames: Unique identifiers for individuals. They are case-sensitive and one-of-a-kind on the system.
๐ User IDs (UIDs): Numeric labels assigned to users for system recognition. The root user, aka the superuser, wears the crown with a UID of 0 and unrestricted access.
๐ก Home Directories: Users have their own cozy corner called the home directory. Here, they can stash files and tailor their environment. By default, it's nestled under
/home
, named after the user.๐ Shells: These are the magic wands of the command-line world. Shells allow users to interact with the system. Typically, it's Bash, but users can choose their favorite.
Groups in Linux
Groups are the support acts in the Linux theater. They bring users together under a common banner, simplifying management and boosting security by facilitating shared permissions and access rights.
Varieties of groups in Linux:
๐ฅ Primary Group: Every user has one. It's like their fan club, listed in
/etc/passwd
. By default, it shares the user's name. Users can join multiple secondary groups.๐ฅ Secondary Groups: These are supplementary groups for users who want to explore more. Secondary groups offer extra permissions and access to resources.
๐ Special Groups: Linux has special groups for system tasks, like the all-powerful
root
group for superuser operations.
Commands for Users and Group
useradd - It is used to create new user in the machine.
id - It is used to find out user and group names and numeric ID's (UID or group ID) of the current user or any other user in the server.
groupadd - It is used to add a new group in the machine.
usermod - To add user in the group.
Here, argument "-aG " means append the user in supplementary group.
Another way of adding user into group is through vim editor.
passwd - To set password for specific user.
su - It is used to switch the user.
userdel - It is used to delete a specific user from the system.
groupdel - It is used to delete a specific group from the system.
lsof - Used to list the file opened by a user.
Conclusion
The world of Linux is an adventure waiting to be explored. Mastering user and group management is your golden ticket to a structured and secure Linux environment. As you continue your Linux journey, remember that understanding users and groups is not just a skill but a superpower for anyone aspiring to be a proficient Linux user or administrator. ๐๐ง๐ป
If you enjoy reading this blog, please give it a like and share it with others! ๐ Don't forget to explore my other articles as well! ๐