Skip to main content

Command Palette

Search for a command to run...

Building a Strong Linux Foundation: User Management, Group Administration, and File Permissions

Updated
5 min read
Building a Strong Linux Foundation: User Management, Group Administration, and File Permissions

Linux is one of the most important skills for anyone pursuing careers in Cloud Computing, DevOps, System Administration, or Cybersecurity. While learning Linux, I explored how users, groups, and permissions work behind the scenes.

In this article, I'll share the key Linux administration concepts I practiced, including user creation, group management, file permissions, and Docker access control.


1. Creating Users in Linux

Linux is a multi-user operating system. Multiple users can access the same system with different permissions.

Create a User

sudo useradd -m mn1

Verify User Creation

cat /etc/passwd

Set Password

sudo passwd mn1
This file contains information about all users available on the system.

2. Switching Between Users

To log in as another user:

su - mn1

Check Current User

whoami

Output:

mn1

This command displays the currently logged-in user.


3. Deleting Users

If a user is no longer required:

sudo userdel mn1

Verify again:

cat /etc/passwd

4. Understanding Linux Groups

Groups help administrators manage permissions efficiently.

Instead of assigning permissions individually, users can be added to groups.

Create a Group

sudo groupadd interns

Verify Group Creation

cat /etc/group

6. Adding Users to a Group

To add a user into a group:

sudo gpasswd -a mn1 interns

Check:

cat /etc/group

You should see the user listed under the group.


7. Deleting Groups

Remove a group using:

sudo groupdel interns

Verify:

cat /etc/group

8. Understanding Linux Permissions

Linux permissions are represented by:

Permission Symbol Value
Read r 4
Write w 2
Execute x 1

Binary Representation

Number Permission
0 ---
1 --x
2 -w-
3 -wx
4 r--
5 r-x
6 rw-
7 rwx

9. The Meaning of 777, 770, and 720

Linux permissions are assigned to:

  • Owner (User)

  • Group

  • Others

Example: 777

rwx rwx rwx

Meaning:

  • User → Full Access

  • Group → Full Access

  • Others → Full Access

Example: 770

rwx rwx ---

Meaning:

  • User → Full Access

  • Group → Full Access

  • Others → No Access

Example: 720

rwx -w- ---

Meaning:

  • User → Full Access

  • Group → Write Only

  • Others → No Access


10. Changing File Permissions

Use:

chmod 770 filename

Example:

sudo chmod 770 project.txt

This grants full access to owner and group while restricting others.


11. Changing File Ownership

To change file owner:

sudo chown mn1 project.txt

Verify:

ls -l

12. Changing Group Ownership

To assign a file to a group:

sudo chgrp interns project.txt

Verify:

ls -l

This helps teams collaborate securely.


13. Docker Permission Issues

After installing Docker, you may encounter:

docker ps

Output:

permission denied

This happens because the user doesn't have permission to access Docker's socket file.

Check Docker Socket

ls -l /var/run/docker.sock

Better Solution

Instead of using chmod 777, add the user to the Docker group:

sudo usermod -aG docker $USER

Apply changes:

newgrp docker

Now test:

docker ps

This is the recommended and secure approach.


14. Understanding umask

umask controls the default permissions assigned to newly created files and directories.

Check current value:

umask

Example Output:

0022

This means newly created files and directories will have restricted permissions by default.


15. Getting Help in Linux

Whenever you're unsure about a command:

command --help

Example:

groupadd --help

Learning to read documentation is one of the most valuable Linux skills.


Final Thoughts

Linux administration is not just about memorizing commands—it's about understanding how access control, security, and user management work together.

These concepts form the foundation of DevOps, Cloud Computing, System Administration, and Docker environments. The more hands-on practice you get with users, groups, and permissions, the more confident you'll become managing real-world Linux systems.