Home

About Us

Advertisement

Contact Us

PRIVACY POLICY

  • Facebook
  • X
  • Instagram
  • Pinterest
  • WhatsApp
  • RSS Feed
  • TikTok
ALT

Maalavs Blog

Your Trusted Voice Across the World.

  • NEWS
  • Linux Tech Blogs
  • Windows Tech Blogs
  • VIRTUALIZATION Blogs
Search

👥 Linux User Management & Permissions – A Beginner’s Guide

Author: Madhan Gopalakrishnan | Published on : 11-02-2025

User management and permissions are fundamental concepts in Linux, ensuring system security and controlled access to files and resources. In this guide, we’ll cover user accounts, groups, permissions, and essential commands in a structured and beginner-friendly manner. 🚀


🆔 Understanding Users & Groups

Linux is a multi-user operating system, meaning multiple users can operate simultaneously with different permission levels.

🧑‍💻 Types of Users

User TypeDescription
Root User (root)The superuser with full system control.
Regular UserStandard user with limited privileges.
System UsersUsed by system processes (e.g., www-data, daemon).

👥 Understanding Groups

Groups allow multiple users to share permissions for specific files or directories.

Group TypeDescription
Primary GroupAssigned to a user upon creation (same name as the user).
Secondary GroupAdditional groups a user can be part of.

🔑 User Management Commands

🏗️ Creating & Managing Users

CommandDescription
whoamiShow the current logged-in user.
whoList all logged-in users.
id usernameDisplay user ID and group ID.
adduser usernameCreate a new user.
userdel usernameDelete a user account.
usermod -aG groupname usernameAdd a user to a group.
passwd usernameChange user password.
su - usernameSwitch to another user.

🏷️ Managing Groups

CommandDescription
groupadd groupnameCreate a new group.
groupdel groupnameDelete a group.
groups usernameShow groups a user belongs to.
gpasswd -a username groupnameAdd user to a group.
gpasswd -d username groupnameRemove user from a group.

🔐 Linux File Permissions Explained

Linux follows a permission-based security model, where every file and directory has permissions that determine who can read, write, or execute them.

📜 Understanding Permission Levels

SymbolPermission TypeNumeric ValueDescription
rRead4View the contents of a file.
wWrite2Modify or delete a file.
xExecute1Run the file as a program.

Permissions are assigned to three categories:

  1. User (u) – Owner of the file.
  2. Group (g) – Users in the file’s group.
  3. Others (o) – Everyone else.

🔍 Checking File Permissions

CommandDescription
ls -lList files with detailed permissions.
stat filenameShow detailed file information.

Example output:

-rw-r--r-- 1 user group 1234 Jan 1 12:00 file.txt
  • rw- (user) → Read & Write
  • r-- (group) → Read-only
  • r-- (others) → Read-only

🛠️ Changing File Permissions & Ownership

🏗️ Modifying Permissions with chmod

CommandDescription
chmod 777 fileGrant all permissions to everyone.
chmod 755 fileAllow owner full access, others read/execute only.
chmod u+x fileAdd execute permission for user.
chmod g-w fileRemove write permission for group.
chmod o-r fileRemove read permission for others.

📌 Numeric Permission Format:

  • 777 → Full access to everyone (rwxrwxrwx)
  • 755 → Owner full access, others read & execute (rwxr-xr-x)
  • 644 → Owner can read/write, others read-only (rw-r--r--)

👑 Changing Ownership with chown

CommandDescription
chown user fileChange file ownership to a user.
chown user:group fileChange file ownership and group.
chown -R user:group directoryRecursively change ownership for a directory.

🎯 Changing Group Ownership with chgrp

CommandDescription
chgrp group fileChange group ownership of a file.

🛡️ Special Permissions (Advanced)

🔷 SetUID & SetGID

These permissions allow files to be executed with the owner’s or group’s permissions.

SymbolDescription
sSetUID (run file as owner)
SSetGID (run file as group)
tSticky Bit (prevents deletion by non-owners)
CommandDescription
chmod u+s fileEnable SetUID.
chmod g+s fileEnable SetGID.
chmod +t directoryEnable Sticky Bit.

📌 Example:

  • /usr/bin/passwd uses SetUID so normal users can change their passwords.

🏆 Best Practices for User Management & Security

✅ Always use least privilege principle – grant only necessary access. ✅ Use sudo instead of logging in as root. ✅ Regularly audit users with cat /etc/passwd and groups with cat /etc/group. ✅ Apply strong passwords and disable unused accounts. ✅ Restrict file permissions to prevent unauthorized access.


🎯 Conclusion

Understanding user management and file permissions is key to securing and managing a Linux system efficiently. With these concepts and commands, you can control who can access, modify, and execute files on your system. 🚀

Next Steps:

  • Practice these commands in a Linux environment.
  • Learn about ACLs (Access Control Lists) for advanced permission management.
  • Explore sudoers file to manage administrative privileges.

Happy Learning! 🎉

Featured Articles

  • Insights into Royal Family Dynamics

    Insights into Royal Family Dynamics

    February 26, 2025
  • Over 50 Deaths Linked to ‘Unknown Disease’ in Congo

    Over 50 Deaths Linked to ‘Unknown Disease’ in Congo

    February 26, 2025
  • North Korea Accused of Major Cyber Heist

    North Korea Accused of Major Cyber Heist

    February 26, 2025
  • Manchester United Announces Job Cuts Amid Financial Restructuring

    Manchester United Announces Job Cuts Amid Financial Restructuring

    February 26, 2025
  • Shannon Sharpe Criticizes Zion Williamson’s Fitness: A Deep Dive into the Controversy

    Shannon Sharpe Criticizes Zion Williamson’s Fitness: A Deep Dive into the Controversy

    February 26, 2025

Search

Author Details

Madhan Gopalakrishnan

I am a passionate “tech blogger” with a knack for breaking down complex topics into simple insights or exploring the latest trends in AI With 5 years of experience in IT Infra implementation and maintenance, I love to share knowledge through in-depth articles and practical tips. When not writing, you can find my hobby “traveling to offbeat destinations”.

  • X
  • Instagram
  • TikTok
  • Facebook

Follow Us on

  • Facebook
  • X
  • Instagram
  • VK
  • Pinterest
  • Last.fm
  • TikTok
  • Telegram
  • WhatsApp
  • RSS Feed

Categories

  • Article (15)
  • NEWS (73)

Archives

  • February 2025 (88)

Tags

About Us

Maalavs Magazine

It is your hub for the latest news across all domains, from technology and business to travel and innovation. We bring insightful updates, expert opinions, and engaging content to keep you informed and ahead. Whether you’re a tech enthusiast, a business professional, or a curious reader, we’ve got something for you. Stay updated with Maalavs Magazine!

Latest Articles

  • Insights into Royal Family Dynamics

    Insights into Royal Family Dynamics

    February 26, 2025
  • Over 50 Deaths Linked to ‘Unknown Disease’ in Congo

    Over 50 Deaths Linked to ‘Unknown Disease’ in Congo

    February 26, 2025
  • North Korea Accused of Major Cyber Heist

    North Korea Accused of Major Cyber Heist

    February 26, 2025

Categories

  • Article (15)
  • NEWS (73)
  • Instagram
  • Facebook
  • LinkedIn
  • X
  • VK
  • TikTok

Proudly Powered by Maalavs | Maalavs Magazine

Scroll to Top