How to Change Directory Permissions in Linux (and Why It Matters)

One of the most common tasks in Linux administration is changing directory permissions. You may need to secure sensitive data or set up a shared workspace for your team. Understanding Linux permissions is crucial to managing files and directories.

Here’s a walkthrough showing how to share a folder with your team by assigning it to the devteam group and applying the correct permissions. This example assumes the devteam group already exists.

(I’ll cover how to create a group and add members in an upcoming post.)

Index

  1. Check the current permissions
  2. Assign the directory to the team group
  3. Give the owner and group full access
  4. Confirm the setup
  5. Summary

1. Check the current permissions

Before changing anything, check the directory permissions:
ls -ld sharedfiles – Where the directory name is “sharedfiles

You’ll see:

This tells you:

  • Owner: read, write, execute (rwx)

  • Group: read, execute (r-x)

  • Others: read, execute (r-x)

2. Assign the directory to the team group

chgrp devteam sharedfiles

3. Give the owner and group full access

chmod 770 sharedfiles

770 is a permission setting that gives full access to the owner and the group, and no access to anyone else.

7 (owner) → read, write, execute

7 (group) → read, write, execute

0 (others) → no permissions at all

4. Confirm the changes

ls -ld sharedfiles

Now:

  • You (the owner) can read/write/execute

  • Your team (devteam) can read/write/execute

  • No one else can access the folder

5. Summary

This is how shared project directories, departmental folders, and collaboration workspaces are secured in production environments. There are other ways to do this on a more granular level using ACL permissions, and I’ll leave that for another post.

Use Case: Imagine you’re supporting a development team that needs a shared directory where everyone can collaborate, but you don’t want other users on the system to access or modify the files.

Connect with me on LinkedIn to comment or share your experiences with Linux.

#RedHatEnterpriseLinux
#CloudWhistler #CloudEngineer #Linux
#DevOps #RedHat #OpenSource
#CloudComputing #WomenInTech

Leave a Reply