How to Fix PermissionError [Errno 13] in Frappe & ERPNext


Picture this: Youβre in the zone, coding away on your Frappe or ERPNext app. You make a quick change to a Workspace, a Dashboard, or maybe just a simple Report. You hit save, feeling good, and BAM! π₯
The terminal screams at you:
PermissionError: [Errno 13] Permission denied: 'apps/evento/evento/evento/workspace/evento/evento.json'Or maybe itβs blocking your JavaScript:
PermissionError: [Errno 13] Permission denied: 'apps/my_app/my_app/public/js/my_script.js'Panic sets in. "I just want to save my work!" you cry. π
If this feels familiar, don't worry. You are not alone, and more importantly, you haven't broken anything permanently. This is one of the most common rites of passage for new Frappe developers.
Let's fix this, understand why it happened, and make sure it never haunts you again. π»
Here is the secret: Linux is just trying to protect you.
When you install Frappe Bench, you usually do it as a specific user (let's say your username is sab or frappe). This user owns all the files in your bench directory.
The problem starts when you get a little too enthusiastic with the sudo command. π‘οΈ
At some point in the past, you probably ran a command like this:
sudo bench start
# OR
sudo bench updateWhen you run bench with sudo, you are telling the system: "Hey, run this as the Root (Superuser)!" π¦ΈββοΈ
So, when Bench created or modified files during that command, it stamped them with Property of Root.
Now, when you go back to being a normal user (sab) and try to edit those files... Linux steps in:
"Stop! β This file belongs to Root. You are just
sab. You have no power here!"
And that is exactly what [Errno 13] Permission denied means.
Don't take my word for it. Let's catch the culprit red-handed. πΈ
Look at the file path in your error message. For example:
apps/evento/evento/evento/workspace/evento/evento.json
Run this command in your terminal to check the file's ID card:
ls -l apps/evento/evento/evento/workspace/evento/evento.jsonYou will likely see something like this:
-rw-r--r-- 1 root root 3302 Nov 16 09:40 evento.json
^^^^ ^^^^
Owner GroupSee that root root? Thatβs the smoking gun. π«
It should say sab sab (or whatever your username is).
If one file is infected, others might be too. You can scan your entire app for files owned by root:
# Replace 'apps/your_app_name' with your actual app path
find apps/your_app_name -user rootIf that list is long, we have some cleaning up to do. π§Ή
Good news! The fix is super easy. We just need to tell Linux: "Hey, these files actually belong to me."
We use the chown (Change Owner) command.
cd ~/frappe-benchRun this command to give ownership back to your current user.
Note:
$USERis a handy variable that automatically fills in your current username.
sudo chown -R $USER:$USER apps/your_app_nameWant to nuke the problem for ALL apps? (Recommended) π
sudo chown -R $USER:$USER appsNow, restart your bench to make sure everything loads fresh.
For Development:
bench startFor Production:
bench restartTry saving your Workspace or Report again. It should work like a charm! β¨
The best way to fix a problem is to prevent it.
NEVER, EVER run bench commands with sudo.
β Bad:
sudo bench start
sudo bench build
sudo bench migrateβ Good:
bench start
bench build
bench migrateGreat question! You do need sudo for system-level services, but not for bench commands.
Use sudo for:
sudo apt install ... (Installing packages) sudo service nginx reload (Web server) sudo systemctl restart supervisor (Process manager) Keep bench sudo-free!
rwx. 
Confused by prototype and __proto__ in the browser console? Master JavaScript's inheritance model with this clear, expert guide.

Learn how to check and set your Git user.name and user.email for all projects (global) or a single repo (local). Fix your GitHub commit identity.

Stop fighting Git permissions in WSL. This post explains the root cause of the 'Permission Denied' error and shows you the permanent fix.