Let's deep dive into Advanced Linux and explore User and Group Management ๐ง๐ฅ
We will learn about User and group management.
๐ค User Accounts- In Linux, users play a central role in the system's operation and security. Each user is a distinct entity with unique privileges and access rights. Let's explore more:
Every individual interacting with the Linux system has a user account. ๐จโ๐ป๐ฉโ๐ป
User accounts are identified by a username and a unique user ID (UID).
To create a user -
if you don't use the '-m' flag user's home directory will be not created under /home.
All the user details/properties can be found in "/etc/passwd", once the user is created all the details are logged into "/etc/passwd".
To set a password for users -
To check the properties of the user's password - '/etc/shadow' stores all the properties of the user's password.
Switch user -
To change the user login name - Here we changed the user login name from testuser to test. ('-l' flag: The name of the user will be changed from LOGIN to NEW_LOGIN)
To delete a user -
๐ฅ **Groups (**Uniting Users for Collaboration ๐ง)- In the fascinating world of Linux, groups are like friendly gatherings where users with similar interests or tasks come together! Let's explore this concept more:
Linux uses groups to manage access rights to files and directories. ๐
Users in the same group enjoy shared permissions, enhancing security. ๐ก๏ธ
Group information is stored in the
/etc/group
file. ๐๏ธTo create a group -
'groupadd' is used to create a group and we can check the group properties in
/etc/group
The /etc/gshadow file is another essential file in Linux that complements the
/etc/group
file. It is used to store encrypted group passwords or secure group-related information.The fields include
group_name:encrypted_password:admin_users:members
.To add a user to a group -
'-a' flag is used to add a single user and '-M' is used to add multiple users in a group. '-M' overwrites all the users in the group and adds new users.
Remove a user from a group -
'-d' flag is used to remove a user from a group.
To make a user Group Admin -
'-A' flag is used to make a user Admin to a group.
To delete a group -
Managing users and groups effectively ensures proper access controls, security, and collaboration in your Linux environment. It's very crucial to learn Users and Group Management ๐ฅ for a Linux Administrator or a DevOps Engineer.
Next Topic: File System Permissions in Linux