To add read and write permissions to a folder in Linux, you can use the chmod command. For example, if you want to give the owner both read and write permissions, you can run:
chmod u+rw foldername
If you want all users (owner, group, and others) to have read and write permissions, you can use:
chmod a+rw foldername
This command updates the folder’s permission bits so that the specified users can read the contents of the folder and add, modify, or delete files inside it.
Now, let’s go deeper into Linux permissions, how they work for folders, and best practices for safely granting read/write access.
Understanding Linux Permissions for Folders
In Linux, permissions apply not only to files but also to folders (directories). While files focus on whether you can view, edit, or execute them, directories control whether you can list, access, or modify their contents.
For folders, the permissions mean:
- Read (r) → Allows listing the contents of the directory (e.g., ls foldername).
- Write (w) → Allows creating, deleting, or renaming files within the directory.
- Execute (x) → Allows entering the directory (using cd foldername) and accessing files inside.
This means that for a directory to be truly usable, you often need read + write + execute (rwx) together.
Viewing Current Folder Permissions
Before adding permissions, check the existing ones using:
ls -ld foldername
Example output:
drwxr-x--- 2 user group 4096 Sep 14 10:30 project
Here’s the breakdown:
- d → Indicates it’s a directory.
- rwx → Owner has read, write, and execute permissions.
- r-x → Group has read and execute permissions (can view but not modify).
- — → Others have no access.
Adding Read and Write Permissions with chmod
The chmod (change mode) command is the primary tool for modifying permissions. You can use it in symbolic mode or numeric mode.
1. Symbolic Mode
Symbolic mode uses letters for users and symbols for actions:
- u → User (owner)
- g → Group
- o → Others
- a → All (user + group + others)
- + → Add permission
- – → Remove permission
- = → Assign exact permission
Examples:
- Add read and write permission for the owner:
chmod u+rw foldername
- Add read and write permission for the group:
chmod g+rw foldername
- Add read and write permission for everyone:
chmod a+rw foldername
Important: For directories, you should usually also give execute (x) along with read/write so users can navigate inside. For example:
chmod a+rwx foldername
2. Numeric Mode
Numeric mode represents permissions with numbers:
- 4 = read (r)
- 2 = write (w)
- 1 = execute (x)
Combine them:
- 6 = read + write
- 7 = read + write + execute
Examples:
- Give owner full access (7), group read/write (6), others no access (0):
chmod 760 foldername
- Give everyone read and write, but not execute:
chmod 666 foldername
- Give everyone read/write/execute:
chmod 777 foldername
Note: 777 is very permissive and usually insecure on multi-user systems. Use carefully.
Applying Permissions Recursively
If you want to grant read/write permissions to a folder and all its subfolders/files, use the -R option:
chmod -R a+rw foldername
To ensure executability on directories, you can run:
chmod -R a+rwx foldername
This is especially useful when sharing project directories across multiple users.
Managing Ownership with chown
Sometimes, adding read/write permissions isn’t enough if the ownership is incorrect. Each file & indicative has an owner & a group.
Check ownership:
ls -ld foldername
Example:
drwxr-x--- 2 alice devs 4096 Sep 14 10:30 project
Here, alice is the owner, and devs is the group.
To change the owner:
sudo chown bob foldername
To change both owner and group:
sudo chown bob:devs foldername
Once the correct ownership is set, adding read/write permissions works more effectively.
Practical Examples
Example 1: Shared Team Directory
You want your entire team (group devs) to read and write in /var/projects.
sudo chown :devs /var/projects chmod g+rw /var/projects chmod g+x /var/projects
Now, group members can access and modify files inside.
Example 2: Public Read/Write Folder
If you’re setting up a folder where all users can share files:
chmod 777 /home/shared
This allows everyone to read, write, and enter the folder. Be careful with this setting on production systems—it’s best for temporary use.
Example 3: Owner-Only Secure Folder
You want only yourself to have read/write/execute access:
chmod 700 private_folder
No other user can access it.
Best Practices for Folder Permissions
- Avoid 777 in production – While convenient, it creates security risks.
- Use groups for collaboration – Assign shared permissions via groups instead of granting access to everyone.
- Combine with execute – For directories, always pair r and w with x to make navigation possible.
- Use recursive changes carefully – Recursive permissions can unintentionally expose sensitive files.
- Check umask – Default permissions for new files are influenced by umask. Adjust it if needed for your use case.
Troubleshooting Permission Issues
- Still “Permission denied” after chmod?
Check directory ownership using ls -ld. If you’re not the owner, use sudo chmod …. - Files inside the folder not writable?
Use recursive chmod -R to apply permissions to all contents. - Group members can’t write to shared folder?
Ensure the folder has group write permission and the sticky bit (chmod g+s foldername) if needed for collaborative environments.
Conclusion
Adding read and write permissions to a folder in Linux is straightforward with the chmod command. Whether you use symbolic mode (u+rw, g+rw, a+rw) or numeric mode (chmod 666, chmod 777), you can tailor permissions for the owner, group, or all users. For directories, don’t forget to also add execute (x) so users can navigate inside.
By combining chmod with ownership management (chown), you can create secure yet collaborative environments. Always follow best practices—grant only the permissions necessary, avoid insecure settings like 777 when possible, and test your changes with ls -ld to confirm they’re applied correctly.
Mastering folder permissions will help you avoid “Permission denied” errors and keep your Linux environment secure and efficient.



