Linux User and Group Commands Every Beginner Should Know ๐Ÿ‘ฉโ€๐Ÿ’ป- Day 5/90

Linux User and Group Commands Every Beginner Should Know ๐Ÿ‘ฉโ€๐Ÿ’ป- Day 5/90

ยท

3 min read

๐Ÿ‘จโ€๐Ÿ’ผ 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. ๐ŸŒ

  1. ๐Ÿ“› Usernames: Unique identifiers for individuals. They are case-sensitive and one-of-a-kind on the system.

  2. ๐Ÿ†” 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.

  3. ๐Ÿก 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.

  4. ๐Ÿš 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:

  1. ๐Ÿฅ‡ 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.

  2. ๐Ÿฅˆ Secondary Groups: These are supplementary groups for users who want to explore more. Secondary groups offer extra permissions and access to resources.

  3. ๐Ÿ… 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! ๐Ÿ“š

Did you find this article valuable?

Support 90 days of Devops by becoming a sponsor. Any amount is appreciated!

ย