Skip to content
Boomspot
  • Home
Loading...
Boomspot

Daily tech news, software development coverage, Apple reporting, and the gear behind modern music making.

TwitterLinkedIn

Browse

  • Categories
  • Tags
  • Authors

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  • Unsubscribe

© 2026 Boomspot. All rights reserved.

Built by Boomspot
Updated hourly

AI Content Disclosure: Articles on Boomspot are researched, written, and edited with the assistance of advanced AI systems. We combine software-assisted research with editorial oversight to deliver useful, accurate, and practical technical and music production content. Learn more about our editorial approach.

Browse by Category

Technology681Coding193SEO66Linux66Studio Gear47Music Production42Apple Rumors11

Popular Posts

Speed Up Linux Kernel Compile Time: 7 Practical Fixes

Speed Up Linux Kernel Compile Time: 7 Practical Fixes

8 min read
Is Linux on PS5 Worth It? pLinux5-NG vs. a Mini PC

Is Linux on PS5 Worth It? pLinux5-NG vs. a Mini PC

7 min read
How to Test Budget DJ Headphones and Speakers at Home

How to Test Budget DJ Headphones and Speakers at Home

10 min read
Beginner-Friendly Terminal Editor: TTT vs micro vs Edit

Beginner-Friendly Terminal Editor: TTT vs micro vs Edit

8 min read
Affiliate Site Audit: Measure Your Google Traffic Risk

Affiliate Site Audit: Measure Your Google Traffic Risk

11 min read

Recent Posts

Google Automated Calls Business Profile Setting Audit

Google Automated Calls Business Profile Setting Audit

Nov 20, 2026•9 min
Voice Agent Latency Budget: Where a Turn's 1,000 ms Goes

Voice Agent Latency Budget: Where a Turn's 1,000 ms Goes

Nov 20, 2026•8 min
Ansible Touch Always Changed: Make the File Task Idempotent

Ansible Touch Always Changed: Make the File Task Idempotent

Nov 20, 2026•7 min
Yamaha NS-10 Alternatives for a Home Studio: What to Buy

Yamaha NS-10 Alternatives for a Home Studio: What to Buy

Nov 20, 2026•7 min
Check Installed OpenJDK Versions on Linux After Java4Shell

Check Installed OpenJDK Versions on Linux After Java4Shell

Nov 20, 2026•9 min
  1. Home
  2. Linux
  3. Fix wg-quick Permission Denied on Ubuntu (AppArmor)
linux8 min read

Fix wg-quick Permission Denied on Ubuntu (AppArmor)

Your VPN client signs in, then wg-quick fails with permission denied, even under sudo. AppArmor is the quiet culprit. Here is how to confirm it, fix it narrowly, and undo it.

S

Staff

November 20, 2026

Reviewed byDorian

Fix wg-quick Permission Denied on Ubuntu (AppArmor)

You run the VPN client with sudo. It signs in fine. Then wg-quick dies with "permission denied" on a config file that root can obviously read. File permissions are not the problem. AppArmor is, and it ignores who you are.

This guide covers diagnose, fix, verify, and rollback. The hook is a real report: the Mysterium VPN command-line client failing on Ubuntu. The method works for any WireGuard-based client that hands wg-quick a config file from an unusual location.

What happened with Mysterium (as reported)

An It's FOSS article on the Mysterium VPN Linux CLI describes the failure. The reviewer tested v0.3.0 on Ubuntu 26.04 LTS. Sign-in worked, but connecting did not. The client kept asking to run the auth command again, asked for sudo repeatedly, and failed to save the sign-in state. With sudo, the connect command ended in a permission denied error from wg-quick on one of the client's config files. (source)

The developers sent a fix that adds read access for the client's config folder to the AppArmor profile wg-quick uses. According to the article, the client then connected and stayed signed in across reboots.

Treat that as a report, not a verified result. Nobody has independently confirmed it, and the commands below have not been run on Ubuntu 24.04 or 26.04 for this article. The expected output shown later is illustrative.

Why sudo does not help

AppArmor is mandatory access control. The kernel checks what a confined program may touch by profile, not by user. If the wg-quick profile does not list a path, a root-owned process running under that profile still gets denied.

That explains the confusing symptom. The file exists, root owns it, and wg-quick still says no. A VPN client that keeps its configs in its own directory, such as a per-user folder in root's home when run with sudo, is exactly what a stock profile will not anticipate.

Prerequisites

Check these before you change anything.

  1. You are on Ubuntu with AppArmor active. Run sudo aa-status and confirm it reports the module is loaded.
  2. wg-quick is installed. Run command -v wg-quick. On Ubuntu it ships in the wireguard-tools package.
  3. A profile file exists at /etc/apparmor.d/wg-quick. Run ls -l /etc/apparmor.d/wg-quick. If it is missing, this guide does not apply to your system.
  4. You know the exact config path that fails. The error message from the client or wg-quick usually prints it.

One more check matters. The override only takes effect if the main profile includes the local file. Run:

grep -n 'local' /etc/apparmor.d/wg-quick

Look for a line like include if exists <local/wg-quick>. If it is absent, a file in /etc/apparmor.d/local/ does nothing. The Mysterium report implies the include exists on that setup, but check yours.

Step 1: Confirm AppArmor is blocking wg-quick

Reproduce the failure, then search the kernel log right away:

sudo journalctl -k --since '10 minutes ago' | grep -i denied

Or use dmesg:

sudo dmesg | grep -i apparmor | grep -i denied

You want a line with apparmor="DENIED", profile="wg-quick", and comm="wg-quick". Here is an illustrative example with a made-up path: We cover related ground in wine on arm64 avx support: will your windows apps run? explained.

apparmor="DENIED" operation="open" profile="wg-quick" name="/etc/example-vpn/configs/wg0.conf" comm="wg-quick" requested_mask="r" denied_mask="r"

Two fields tell you what to write. The name= field is the path to allow. The requested_mask field says which permission is missing. r means read, so a read-only rule is enough.

If auditd is installed, denials may land in /var/log/audit/audit.log instead of the journal. If you see no DENIED entries at all, stop here. Your problem is something else, such as a wrong file mode or a missing file.

Step 2: Back up, then write a minimal local override

Local overrides exist so you do not have to edit the packaged profile. Package updates can overwrite /etc/apparmor.d/wg-quick, but they leave files in local/ alone.

The It's FOSS article shows its commands flattened onto one line, heredoc included. That will not work as typed, because the heredoc body and the closing EOF each need their own line. Write it like this, and replace the placeholder path with the one from your DENIED message:

sudo cp -a /etc/apparmor.d/local/wg-quick /etc/apparmor.d/local/wg-quick.bak 2>/dev/null
sudo tee /etc/apparmor.d/local/wg-quick > /dev/null <<'EOF'
/etc/example-vpn/configs/ r,
/etc/example-vpn/configs/*.conf r,
EOF

The first line saves any existing local file, and the error is silenced if there is none. Be careful: tee without -a overwrites the file. If you already had custom rules there, append with tee -a instead and remove nothing.

The first rule lets wg-quick list the directory. The second lets it read .conf files directly inside it. Both are read-only, and * does not recurse into subfolders.

Adapt the path, do not copy Mysterium's

The report used /root/.config/mystvpn/wireguard/configs/ and its *.conf files. That path is specific to Mysterium running under sudo. Your client will use something different. Take the path from your own DENIED line, and keep it as narrow as the log allows. Avoid /** r or rw rules. They turn a small hole into a large one.

Step 3: Reload the profile

sudo apparmor_parser -r /etc/apparmor.d/wg-quick

Silence means success. A syntax error prints a message with a line number, and the old profile stays loaded. Then confirm the file contents and the profile state: See check which radeon driver your old gpu uses on linux: the details for additional background.

sudo cat /etc/apparmor.d/local/wg-quick
sudo aa-status | grep wg-quick

You should see your two rules, and wg-quick listed among the loaded profiles.

Step 4: Verify the tunnel

Retry the connection the way you did before. For Mysterium that is sudo mystvpn connect with your country options, per the article. For a plain WireGuard setup, run sudo wg-quick up wg0.

Then check three things:

sudo wg show
ip -brief address show
curl -4 https://ifconfig.me

wg show should list an interface with a recent handshake. The address output should show the tunnel interface up. The public IP should differ from your normal one. Also watch the journal for new DENIED lines. A second denial on a different path means you need another narrow rule, added the same way.

Also read: enable hdr in mpv on wayland: config, checks, fixes

Rollback

If the change did nothing, or you want it gone:

sudo mv /etc/apparmor.d/local/wg-quick.bak /etc/apparmor.d/local/wg-quick
sudo apparmor_parser -r /etc/apparmor.d/wg-quick

If there was no backup because the file did not exist before, delete it with sudo rm /etc/apparmor.d/local/wg-quick instead, then run the same reload. Confirm with sudo aa-status | grep wg-quick and retest. The reload is what makes the rollback real. Editing the file alone changes nothing in the kernel.

Troubleshooting

| Symptom | Likely cause | | --- | --- | | Client repeatedly asks to re-authenticate or run sudo | It cannot save or read state because wg-quick fails underneath. The Mysterium report saw this before the override. Check the journal for DENIED. | | Permission denied as root, with a DENIED line | The profile lacks a read rule for the path in name=. | | Permission denied, no DENIED line | Not AppArmor. Check the file exists, its mode, and the path. | | Rule added, still denied | Profile not reloaded, or the main profile does not include local/wg-quick. Run the reload and the grep from the prerequisites. | | apparmor_parser prints a syntax error | Missing trailing comma, or a stray character from a flattened paste. Rewrite the file line by line. | | New DENIED on a different path | The client touches more than one location. Add one more narrow rule. |

Inspect installers before you run them

The Mysterium article installs the CLI with a curl ... | bash one-liner from its GitHub releases page. Do not pipe anything into a root shell blindly. Download the script, read it, then run it:

curl -fsSLo install.sh https://github.com/mysteriumnetwork/mysteriumvpncli/releases/latest/download/install.sh
less install.sh
bash install.sh

This matters more here, because you are about to loosen a security profile on a machine that handles your network traffic.

What to expect next

A read-only rule like this should survive reboots and routine package updates, since local overrides live outside the packaged profile. The Mysterium report says the client stayed signed in across reboots after the change. A future Ubuntu release could change the wg-quick profile, so recheck after a release upgrade if the error returns. If a client's developers move where it stores configs, the DENIED line will show the new path, and the same four steps apply.

Tags

Open-sourceCoding TutorialsCybersecurityProgramming LanguagesUbuntu

Keep reading

WebAssembly: Unleashing Native Speed in Web Browsers
Coding•4 min read

WebAssembly: Unleashing Native Speed in Web Browsers

WebAssembly is transforming web development with near-native performance, enabling more complex and efficient applications.

Sep 6, 2025

Navigating the Future: Innovations in Tech
Technology•3 min read

Navigating the Future: Innovations in Tech

Dive into the latest in technology, covering AI, digital trends, cybersecurity, and emerging technologies shaping our world.

Sep 6, 2025

Smart Homes Under Siege: The Rise of Cybercrime
Crime•3 min read

Smart Homes Under Siege: The Rise of Cybercrime

Smart homes have transformed into cybercrime targets, with smart devices' vulnerabilities exposed and steps highlighted for bolstering security.

Sep 6, 2025

More stories for your next project

Get tech, coding, and music production updates in your inbox.

Unsubscribe anytime.