Home Linux AdministrationLinux Permissions and Privileges Explained: Groups, sudo, and System Control

Linux Permissions and Privileges Explained: Groups, sudo, and System Control

By sk
654 views 9 mins read

Linux permissions explain file access, but they do not explain system authority. Many users learn chmod and stop there, which creates confusion later when files look correct but actions like reboot or service control still fail.

This guide explains Linux permissions and privileges, how groups fit in, and why modern Linux handles system control differently than you might expect.

The Classic Unix Permission Model

Every file in Linux has three types of ownership:

  • An owner (a specific user)
  • A group (a collection of users)
  • Everyone else (all other users on the system)

Each identity can have three types of access:

  • Read (r) - View the file contents
  • Write (w) - Modify the file
  • Execute (x) - Run the file as a program

You can view these permissions with:

ls -l /usr/bin/sudo

Which outputs something like:

-rwsr-xr-x 1 root root 281624 Jun 24  2025 /usr/bin/sudo

Breaking this down:

  • -rwsr-xr-x - Permission bits (more on that 's' later)
  • root root - Owner is root, group is root
  • The owner can read, write, and execute
  • The group can read and execute
  • Everyone else can read and execute

This model controls who may open, modify, or run a file. It's simple, foundational, and still matters for protecting data and programs. This is the core of Linux file and directory permissions.

Why Linux Groups Matter for Permissions

Groups allow controlled sharing without giving everyone access or managing permissions per-user.

Linux uses groups to grant access to hardware and resources:

  • audio - Sound devices and audio hardware
  • video - GPUs and graphics devices
  • plugdev - USB devices and removable media
  • libvirt / kvm - Virtual machines
  • disk - Direct disk access

Here's a practical example. Check your video device:

ls -l /dev/dri/card1

You might see:

crw-rw----+ 1 root video 226, 1 Dec 30 18:00 /dev/dri/card1

The device is owned by root and the video group. Anyone in the video group can access the GPU, even though they're not root.

To add a user to the group, we usually do:

sudo usermod -a -G video username

Now that user can use the GPU. Remove them from the group, and access stops immediately (after they log out and back in).

Groups scale better than per-user rules and remain central to Linux security. They provide granular control without excessive complexity.

How Traditional Unix Systems Delegated Privileges

Older Unix systems used groups and file ownership for system authority, not just file access.

Common patterns included:

  • Special groups like operator or shutdown
  • System binaries (like /sbin/halt) owned by those groups
  • The setuid or setgid bit allowing group members to execute with elevated privileges

For example, the shutdown binary might have been owned by the operator group with special permissions. Members of that group could shut down the machine because they could execute the binary with elevated authority.

Trust was broad but clear. If you trusted a group, you gave it power through file ownership and special permission bits. This approach worked well on shared servers and multi-user terminals.

How Modern Linux Controls Privileged Actions

Modern Linux no longer relies primarily on file ownership for system control. Instead, privileged actions go through policy-based authorization layers.

When you run shutdown or systemctl restart, Linux doesn't check file permissions first. It checks whether you're allowed by policy, typically enforced by:

  • systemd - The init system and service manager
  • polkit (formerly PolicyKit) - Authorization framework for system-wide policies
  • D-Bus - Message bus that mediates system requests

Here's what actually happens when you try to reboot:

systemctl reboot
  1. Your command goes through D-Bus to systemd
  2. Polkit intercepts the authorization request
  3. Polkit checks rules in /usr/share/polkit-1/actions/ and /etc/polkit-1/rules.d/
  4. It evaluates whether you're allowed based on:
    • Whether you're at the physical console (local vs remote)
    • Your user ID and group memberships
    • Active session status
    • Specific policy rules

For example, the policy file /usr/share/polkit-1/actions/org.freedesktop.login1.policy contains:

<action id="org.freedesktop.login1.reboot">
  <defaults>
    <allow_any>auth_admin</allow_any>
    <allow_inactive>auth_admin</allow_inactive>
    <allow_active>yes</allow_active>
  </defaults>
</action>

This says:

  • Remote users (allow_any) must authenticate as admin
  • Inactive sessions must authenticate as admin
  • Active local sessions can reboot without authentication

Local console users may reboot without sudo, while remote SSH users usually need explicit permission. This behavior is consistent across modern systemd-based Linux distributions like Ubuntu, Fedora, Arch, and Debian.

Linux Permissions vs Privileges: The Key Difference

AspectPermissionsPrivileges
ControlsFile accessSystem authority
DecidesWho can read, write, execute filesWho can manage services, reboot, act as root
MechanismFile ownership and mode bitsPolicy rules and authorization frameworks
Changed bychmod, chown, chgrpsudo configuration, polkit rules
ExampleCan you edit /etc/hosts?Can you restart the network service?

Permissions control file access. Privileges control system authority.

This distinction explains why correct file permissions don't always grant control. You might have execute permission on /usr/sbin/reboot, but that doesn't mean you can reboot the system without proper privileges.

Confusing permissions and privileges leads to security mistakes and frustration when things don't work as expected.

The Role of sudo and the wheel Group

The wheel group (on Red Hat-based systems) or sudo group (on Debian-based systems) often confuses people. These groups aren't inherently powerful—they matter because system policy trusts them.

When you run:

sudo systemctl restart apache2

Linux checks /etc/sudoers (and files in /etc/sudoers.d/). A typical configuration includes:

%sudo   ALL=(ALL:ALL) ALL

Or on Red Hat systems:

%wheel  ALL=(ALL)       ALL

This line means: "Members of the sudo (or wheel) group can run any command as any user on any host."

The group membership is just a signal. The sudoers configuration grants the actual power. You can check what you're allowed to do:

sudo -l

This might output:

User senthil may run the following commands on debian:
    (ALL : ALL) ALL

This is why sudo vs permissions is an important distinction. Sudo grants privileges through configuration policy, not through file permissions.

Why Some Groups Are High Risk

Some Linux groups grant such deep access that membership effectively provides root-level capabilities.

Critical Groups to Understand

docker - Members can start containers, mount host filesystems, and escape to root:

docker run -v /:/host -it ubuntu chroot /host

This mounts the entire host filesystem and gives you a root shell.

disk - Members can read and write raw disk devices:

dd if=/dev/sda of=/tmp/disk.img

This bypasses all file permissions and can extract any data from the disk.

sudo / wheel - Members can become root (as discussed above)

libvirt / kvm - Members can create virtual machines that access host resources

lxd - Similar to docker, can be exploited for privilege escalation

adm - Can read most log files, potentially exposing sensitive information

Adding users to these groups without understanding the impact is dangerous. Group membership is a security decision, not just a convenience feature.

Practical Scenario: Diagnosing Permission vs Privilege Issues

Let's work through a common problem:

Situation: You want to restart the Apache web server.

$ systemctl restart apache2
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to restart 'apache2.service'.

Diagnosis:

1. Check the file permissions:

$ which systemctl
/usr/bin/systemctl
$ ls -l /usr/bin/systemctl
-rwxr-xr-x 1 root root 1353368 Jun 26 2025 /usr/bin/systemctl

You can execute systemctl (the x bit is set for everyone).

Check if you're in the sudo group:

$ groups
senthil adm cdrom dip plugdev

You're not in the sudo group.

Check sudo privileges:

$ sudo -l
[sudo] password for senthil:
Sorry, user senthil may not run sudo on debian.

You have no sudo privileges.

    Solution: The issue isn't file permissions—you can execute the binary. The issue is privileges. You need to either:

    • Be added to the sudo group: sudo usermod -a -G sudo senthil
    • Be given specific sudo permissions for systemctl in /etc/sudoers.d/
    • Use a privileged session or be at the local console (depending on polkit policy)

    This demonstrates why understanding both permissions and privileges matters.

    Common Questions About Linux Permissions and Privileges

    Q: Can Linux groups grant root access?

    A: No, groups alone cannot grant root access. They only matter when trusted by authorization tools like sudo or system policy. The group wheel has no inherent power—it's powerful because /etc/sudoers typically trusts it.

    Q: Is sudo a permission or a privilege?

    A: It's a privilege. Sudo grants authority through policy configuration, not file permissions. Even if you could somehow change the permissions on /usr/bin/sudo, it wouldn't grant you sudo access.

    Q: Why can some users shut down Linux without sudo?

    A: Because polkit policy allows it based on session status. Local console users with active sessions typically have automatic authorization to reboot or shut down, while remote SSH users do not. This is not controlled by ownership of the shutdown binary.

    Q: What's the difference between setuid and sudo?

    A: Both elevate privileges, but differently:

    - setuid is a file permission bit that makes a program run as its owner (often root). It's built into the file system.
    - sudo is a program that checks policy files to decide whether to grant privileges. It's more flexible and auditable.

    Modern systems prefer sudo because it's configurable, logged, and doesn't require special file permissions.

    Q: How do I check what groups I'm in?

    A: Use the groups command to see your current groups, or id for more detail:

    groups
    id

    Note that group changes only take effect after logging out and back in.

    Key Takeaways

    What you need to remember:

    1. File permissions (rwx, chmod) control file access i.e who can read, write, or execute files
    2. Privileges (sudo, polkit) control system authority i.e who can perform administrative actions
    3. Modern Linux uses policy-based authorization, not just file ownership
    4. Some groups like docker and disk are effectively root access
    5. Being able to execute a system binary doesn't mean you can use its functionality
    6. When troubleshooting, ask: "Is this a permission issue (file access) or a privilege issue (system authority)?"

    For further learning:

    The Unix Philosophy Still Holds

    Unix didn't abandon its principles of predictable behavior, clear delegation, and minimal trust. What changed is the mechanism used to implement these principles.

    File ownership and groups still protect data. Policy-based authorization now protects system power. Understanding both lets you manage Linux systems with confidence, diagnose issues correctly, and make informed security decisions.

    You May Also Like

    Leave a Comment

    * By using this form you agree with the storage and handling of your data by this website.

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More