Change Permission Of Folder In Ubuntu

8 min read

Knowing how to change permission of folder in Ubuntu is an essential skill for anyone managing a Linux server or desktop environment. Whether you are a developer deploying a web application, a system administrator securing sensitive data, or a beginner exploring the command line, understanding Ubuntu folder permissions helps you protect your files while allowing the right users to access them. Think about it: incorrect permission settings can lead to "Permission denied" errors, security vulnerabilities, or broken applications. In this guide, you will learn how to check, modify, and manage folder permissions in Ubuntu using practical commands and real-world examples The details matter here..

Understanding File Permissions in Ubuntu

Ubuntu, like all Linux distributions, treats almost everything as a file. This includes folders, devices, and even system processes. Because multiple users can share the same system, Ubuntu uses a permission model to decide who can read, modify, or enter a specific folder. Before you change permission of folder in Ubuntu, it is important to understand how these permissions are structured Still holds up..

Short version: it depends. Long version — keep reading.

The Three Basic Permissions

Every file and folder in Ubuntu has three fundamental permission types:

  • Read (r): Allows a user to view the contents of a file. For a folder, read permission lets a user list the files and subfolders inside it.
  • Write (w): Allows a user to modify or delete a file. For a folder, write permission lets a user create, rename, or delete files within that directory.
  • Execute (x): Allows a user to run a file as a program or script. For a folder, execute permission lets a user enter the directory using the cd command and access files inside it.

The Three User Classes

Permissions are assigned to three different classes of users:

  • Owner (u): The user who owns the file or folder, usually the person who created it.
  • Group (g): A group of users who share access to the file or folder.
  • Others (o): Every other user on the system who is neither the owner nor a member of the group.

When you run a listing command, Ubuntu displays these permissions as a string such as drwxr-xr-x. Practically speaking, the first character indicates the file type (d for directory, - for regular file). The next three characters represent the owner's permissions, the following three represent the group's permissions, and the last three represent others.

How to Check Current Folder Permissions

Before making changes, you should always inspect the existing permissions. The most common way to do this is with the ls command.

Open your terminal and run:

ls -ld foldername

## How to Change Folder Permissions

When you need to adjust the access rights of a directory, the **`chmod`** command is the primary tool. Consider this: it can accept either a symbolic mode (using letters) or a numeric mode (using octal digits). Choose the style that best fits the situation.

### Symbolic Mode

Symbolic mode modifies specific user classes without having to rewrite the entire permission set. The basic syntax is:

```bash
chmod  
  • who – u (owner), g (group), o (others), or a (all users).
  • operation – + to add a permission, - to remove a permission.
  • permission – r, w, or اهن (read, write, execute).

Examples

# Add execute permission for the owner (so they can cd into the folder)
chmod u+x project_folder

# Grant read and write to the group, but nothing to others
chmod g+rw,o-rwx project_folder

# Remove all permissions for "others"
chmod o-rwx project_folder

Numeric Mode

Numeric mode uses a three‑digit octal number where each digit represents the combined permissions for owner, group, and others. The values are:

  • 4 = read (r)
  • 2 = write (w)
  • 1 = execute (x)

Add them together to form each digit (e.g., 7 = rwx, 6 = rw-, 5 = r-x) That's the part that actually makes a difference..

Examples

# Full control for owner, read/execute for group and others
chmod 750 project_folder

# Only the owner can read, write, and execute; everyone else has no access
chmod 700 project_folder

# Public read‑only directory (anyone can list contents but not modify)
chmod 644 project_folder

Applying Permissions Recursively

If you have a nested structure and want the same permission pattern for every subdirectory and file, add the -R flag:

chmod -R 755 /path/to/application

Using Access Control Lists (ACLs)

While traditional permissions handle the basic owner/group/others model, ACLs let you grant more granular rights. They are especially handy in multi‑user environments or when a single user needs special access without altering the overall permission set.

# Install ACL support (usually already present)
sudo apt install acl

# Set an ACL entry: give user "alice" read/write access
setfacl -m u:alice:rw /shared/folder

# View current ACLs
getfacl /shared/folder

Remember to keep the default ACL (--set-default) if you want new files created inside the directory to inherit the same rules Simple, but easy to overlook. And it works..

Best Practices for Managing Folder Permissions

  1. Apply the Principle of Least Privilege – Give users only the rights they truly need. Over‑permissive directories are a common attack vector.
  2. Use Groups for Collaboration – Instead of granting permissions to individual users, add them to a group and set group‑level

permissions on the shared directory. Even so, 5. , a temporary upload drop zone), combine it with the sticky bit (chmod 1777) so users can only remove their own files. Here's the thing — 3. This prevents attackers from overwriting application code even if they compromise a data upload path. g.If absolutely necessary (e.4. On top of that, Separate Data from Executables – Keep scripts and binaries in directories with 755 (read/execute for all, write only for owner) while storing writable data in directories with 770 or 700. In real terms, this simplifies administration when team members join or leave. Reserve 777 for Exceptional Cases Only – World-writable directories (chmod 777) allow any user to create, modify, or delete files. Audit Regularly with find – Schedule periodic scans to catch permission drift:

# Find world-writable directories missing the sticky bit
find /var/www -type d -perm -0002 ! 

# Locate files with overly broad permissions
find /home -type f -perm /o=w -ls
  1. , 027 or 077) in /etc/profile or user shell rc files so newly created files and directories start with safe permissions, reducing the need for corrective chmod runs. put to work umask for Defaults – Set a restrictive default umask (e.7. g.Here's the thing — Document Your Scheme – Maintain a simple matrix mapping directory paths to intended permission sets and responsible groups. This aids onboarding, compliance audits, and incident response.

Conclusion

Effective folder permission management is less about memorizing octal codes and more about designing a clear access-control strategy that aligns with your operational workflows. By combining the precision of symbolic and numeric modes, the flexibility of ACLs, and the discipline of least-privilege principles, you create a filesystem that is both collaborative and resilient. Regular audits, sensible defaults, and thorough documentation make sure your permission model remains solid as your environment evolves—turning a routine administrative task into a cornerstone of system security.

Honestly, this part trips people up more than it should.

Effective folder permission management is less about memorizing octal codes and more about designing a clear access‑control strategy that aligns with your operational workflows. By combining the precision of symbolic and numeric modes, the flexibility of ACLs, and the discipline of least‑privilege principles, you create a filesystem that is both collaborative and resilient. Regular audits, sensible defaults, and thorough documentation confirm that your permission model remains dependable as your environment evolves—turning a routine administrative task into a cornerstone of system security.

Easier said than done, but still worth knowing.

Additional safeguards to consider

  • Automate enforcement – Integrate a lightweight policy engine (such as pam_acls or a custom wrapper around chown/chmod) into your deployment pipeline. This guarantees that every new directory or file created by the application inherits the correct permissions without manual intervention.
  • apply container isolation – When deploying services in containers, define explicit read:writable mounts for each component and avoid mounting host filesystems that are not scrubbed. The container’s own umask can be set to a restrictive value (e.g., 0o077) so that any files created inside the container start with the intended baseline.
  • Monitor with logging – Enable audit logging for permission changes (e.g., via auditd with the inode or access rules). Correlate these events with the scripted audits mentioned earlier to spot drift before it becomes exploitable.
  • Educate users and developers – Provide short training modules that illustrate the impact of world‑writable directories and show how to request a permission change through the proper ticketing system. When ownership is clear, accidental over‑privilege drops sharply.
  • Plan for lifecycle changes – As projects evolve, directories may be retired or merged. Before decommissioning a folder, run a final permission sweep and verify that no lingering files retain overly permissive attributes. Document the retirement process to avoid “zombie” directories that later become attack vectors.

Putting it all together

  1. Define a permission matrix – List every critical path (e.g., /var/www/uploads, /opt/app/data, /home/team/shared) and assign the appropriate mode (700, 770, 777 only for temporary drop zones, etc.) based on the role of the directory.
  2. Apply the matrix – Use chmod/chown in bulk with find or a configuration management tool, then lock the settings with setfacl if group‑level tweaks are required.
  3. Lock down defaults – Set the system‑wide umask to 0o077 in /etc/default/user or in the profile of all regular users. This guarantees that any newly created file starts with the same restrictive base.
  4. Review and repeat – Schedule a quarterly review of the permission matrix, re‑run the find scans, and update the documentation matrix if any new services or shared resources are introduced.

By embedding these practices into your development lifecycle, you transform permission management from a one‑off checklist into an ongoing, self‑healing process. The result is a filesystem architecture that supports collaboration, limits exposure, and stands up to the threats that modern environments encounter. Implement the steps above, keep the documentation current, and you’ll have a security posture that is both proactive and resilient.

What Just Dropped

New This Week

Similar Ground

On a Similar Note

Thank you for reading about Change Permission Of Folder In Ubuntu. We hope the information has been useful. Feel free to contact us if you have any questions. See you next time — don't forget to bookmark!
⌂ Back to Home