You type a simple command in your Linux Mint terminal and instead of the result you expect, you get slapped with "Permission denied". You add sudo to the front of the command, expecting root privileges to fix everything — and it still fails. This is one of the most common and most confusing errors Linux Mint users run into, because it breaks the usual assumption that "sudo fixes permission problems."
The truth is that "Permission denied" in Linux Mint can come from several completely different causes: broken file ownership, a sudo redirection quirk that catches almost everyone at least once, misconfigured folder permissions, or simply trying to write somewhere your user account was never meant to touch. This guide walks through each cause with the exact terminal commands and file manager steps needed to fix it for good.
Why You're Getting Permission Denied (Even With Sudo)
In Linux Mint (and Linux in general), every file and folder has an owner, a group, and a set of permissions that determine who can read, write, or execute it. When a command fails with "Permission denied," it means the user account running that command does not have the required permission on that specific file or directory.
Normally, prefixing a command with sudo temporarily elevates you to root, which can read and write almost anything on the system. But there are three situations where sudo alone does not solve the problem:
- File ownership is broken — files in your own home folder are owned by
rootor another user (often after restoring a backup, running an installer as root, or editing files withsudo nanorepeatedly), so even your own account cannot write to your own files. - Shell redirection happens before sudo runs — commands using
>or>>to write output to a file are handled by your unprivileged shell, not by sudo, so the redirect itself still fails. - You're working in a restricted system directory — folders like
/,/etc, or/usrare intentionally locked down, and normal day-to-day work should not happen there at all.
Once you know which of these three you're facing, the fix usually takes less than a minute.
Quick Fix: Correct File Ownership With chown
If you're getting "Permission denied" while trying to save, edit, or delete files inside your own home directory, the most likely cause is incorrect ownership. This commonly happens after:
- Restoring files from a backup or another machine
- Running an application installer with
sudothat wrote files into your home folder - Editing configuration files with
sudoand having new files created as root
Check who owns a file or folder with:
ls -la
If you see root listed as the owner of files that should belong to you, reclaim ownership of your entire home directory with:
sudo chown -Rv $(id -u):$(id -g) ~
Here's what this command actually does:
chownchanges the owner of files-Rapplies the change recursively to every file and subfolder-vprints each file as it's changed, so you can confirm it worked$(id -u):$(id -g)automatically inserts your current user ID and group ID, so you don't need to know your username~targets your home directory
Run this and try your original command again. In the vast majority of "permission denied in my own home folder" cases, this single command resolves it completely.
Method 2: Fix the Sudo Redirection Trap
This is the gotcha that trips up even experienced Linux users, and almost no beginner guide explains it properly. Say you try to add a line to a protected system file like this:
sudo echo "127.0.0.1 example.local" > /etc/hosts
You'd expect sudo to grant permission to write to /etc/hosts. Instead, you get "Permission denied" — and it looks like sudo simply isn't working.
Here's why: when you run this command, your shell parses it in two separate parts before anything executes. The > redirection operator is handled entirely by your unprivileged shell, not by the sudo echo command. Only echo runs with elevated root privileges — the actual act of opening /etc/hosts for writing and redirecting text into it happens as your normal, non-root user, which does not have write access to that file. So the redirection fails before sudo's elevated privileges ever come into play.
The fix is to pipe the output through tee, which is a program that itself can be run with sudo and handles the file writing with root privileges:
echo "127.0.0.1 example.local" | sudo tee /etc/hosts
In this version, echo runs normally in your shell and its output is piped to sudo tee, which runs as root and writes the content into the protected file. If you want to append to the file instead of overwriting it, use tee -a:
echo "127.0.0.1 example.local" | sudo tee -a /etc/hosts
Remember this rule: redirection with > or >> never inherits sudo's privileges. Whenever you need to write to a protected file, reach for sudo tee instead.
Method 3: Check Folder Permissions via File Manager
If you'd rather not live in the terminal, Linux Mint's Nemo file manager lets you inspect and fix permissions visually:
- Right-click the folder or file causing the error and select Properties.
- Click the Permissions tab.
- Check the Owner field — if it isn't your username, that's your problem.
- Under "Folder Access," confirm the owner has "Create and delete files" permission (not just "List files only" or "Read only").
- If you're the owner and permissions still look wrong, tick "Apply Permissions to Enclosed Files" if available, then click OK.
You can cross-check the same information from the terminal at any time with:
ls -la /path/to/folder
This prints permissions in the familiar drwxr-xr-x format along with the owner and group. If you need to grant write access manually rather than through the GUI, use chmod:
chmod -R u+rwx ~/Documents/myfolder
This adds read, write, and execute permission for the owning user across the folder and everything inside it.
Method 4: Stay Out of Restricted Directories
Sometimes "Permission denied" isn't a bug at all — it's Linux Mint working exactly as designed. System directories such as /, /etc, /usr, /bin, and /var are intentionally restricted so that ordinary applications and user accounts can't accidentally corrupt the operating system.
If you find yourself running commands from one of these locations and hitting permission errors, ask yourself whether you actually need to be there. In most day-to-day use, you should be working inside your home directory:
cd ~
Only use sudo to reach into system directories when you have a specific, intentional reason — such as editing a configuration file, installing software system-wide, or managing services. Making system-level changes a habit (rather than the exception) is a common way permissions get accidentally broken in the first place, leading right back to the ownership problems covered above.
If you regularly find yourself fighting permission errors while managing servers, deploying applications, or maintaining Linux systems for your business, it may be worth having a professional take a look rather than risking further misconfiguration. CloudHouse Technologies' pay-per-ticket Linux support can resolve stubborn permission and ownership issues quickly without a recurring support contract.
Frequently Asked Questions
Why does sudo not fix permission denied errors?
Sudo elevates the privileges of the command that follows it, but it does not elevate operations handled directly by your shell, such as output redirection with >. If a command combines sudo with redirection to a protected file, the redirection itself still runs as your normal user and fails. Use sudo tee instead for writing to protected files.
How do I fix "permission denied" when saving a file in my home folder?
This is almost always an ownership problem. Run sudo chown -Rv $(id -u):$(id -g) ~ to reclaim ownership of your entire home directory, then try saving the file again.
What does chown -R actually do?
The chown command changes file ownership, and the -R flag makes it recursive, meaning it applies to the target folder and every file and subfolder inside it. This is useful for fixing ownership across an entire directory tree in one command.
Is it safe to run chmod 777 to fix permission denied?
No. chmod 777 grants read, write, and execute permission to every user on the system, which is a security risk, especially on shared or internet-facing machines. Use a more targeted fix like chmod u+rwx for the owner, or correct ownership with chown instead.
Why does "cannot create file: permission denied" happen in a specific folder only?
This usually means that particular folder has different ownership or permissions than the rest of your home directory, often because it was created by a different user, an installer running as root, or copied from another system. Check it with ls -la and fix ownership with chown or permissions with chmod as needed.
