Chromebook & Linux

Linux says 'permission denied' running or saving a file

Permission denied errors mean the current user doesn't have the rights needed for that file or folder, not that something is broken. Adjusting ownership or permissions resolves it.

Difficulty
Intermediate
Time
5–20 minutes
DIY cost
$0

Symptoms

  • 'Permission denied' when running a script
  • Can't save changes to a file
  • Can't write to a folder you expect to own
  • Works with sudo but not normally

Likely causes

  • CommonFile isn't marked executableScripts need execute permission set before they can be run directly.
  • CommonFile or folder owned by a different user or rootFiles created by an installer or another user may not be writable by your account.
  • PossibleWorking in a protected system directoryDirectories like /etc or /usr require elevated privileges to modify.

What to do

  1. Check current permissions with 'ls -l [filename]' to see who owns it and what access is allowed.
  2. To make a script executable, run 'chmod +x [filename]' then try running it again with './[filename]'.
  3. If the file is owned by another user or root, and it should be yours, run 'sudo chown $USER [filename]' to take ownership.
  4. Avoid using 'sudo' as a habitual fix for every permission issue since it can create files owned by root that cause future problems.
  5. If working in a system directory, confirm you actually need to modify it there versus your home folder.
  6. For persistent confusing permission issues, run 'namei -l [path]' to see permissions at every level of the path.

Tools and parts

  • Terminal access

When to call a pro

Not typically needed; this is standard Linux administration.

Safety

Generally low risk

Generally low risk for a careful person. Stop if anything looks different from what this guide describes.

Related guides

Operator provides AI-generated troubleshooting information. It can be wrong. For safety-critical, electrical, gas, structural, medical, automotive safety, or other high-risk problems, consult a qualified professional.