ACLClouds
ACLClouds

Error “Permission denied” when launching or writing files

Fix the path or the execute permission from the panel, without opening every permission with 777. Containers run as a non-root user.

Containers run as a non-root user. An archive may keep the wrong permissions, or a shell script may not be executable.

Step-by-step procedure

  1. Identify the refused action

    Distinguish between running a script and writing to a folder. The fix is not the same.

  2. Check the path

    Write only to the server’s folders, not to /root, /usr or an absolute path from your own computer.

  3. Grant only the permissions you need

    For a shell script, give the file the value 755 with the “Permissions” action of the “Files” tab, or replace the “Start command” in the “Startup” tab with sh start.sh. File ownership cannot be changed.

  4. Avoid 777

    Overly broad permissions hide the problem and increase the risk. Prefer 755 for a folder and 644 for a regular file.

Path relative to the script folder

// Node.js
const path = require('node:path');
const file = path.join(__dirname, 'data', 'config.json');

// Python
// from pathlib import Path
// file = Path(__file__).parent / "data" / "config.json"

What the container allows

On ACLClouds, the bot runs in a container as a non-root user, and the container’s system is read-only. Writing is only possible in the bot folder, mounted on /app: it is the one you see in the “Files” tab. The /tmp folder exists too, but it is limited to 32 MB, its contents are not kept and it does not allow programs to be executed.

A “Permission denied” error therefore almost always comes from one of these cases: the code writes outside the bot folder, a script is started without the execute permission, or a command tries to change the system, for example a global install. Changing permissions only solves the second case.

Changing permissions from the panel

In the “Files” tab, the “Permissions” action of a file expects a three-digit octal value. The first digit applies to the owner, the second to the group, the third to other users. Each digit adds 4 for read, 2 for write and 1 for execute.

A script uploaded from Windows or extracted from a ZIP archive often loses its execute permission: this is the most common cause for a .sh file. If the error persists on one specific file, delete it and upload it again from “Files” or over SFTP, rather than extracting the same archive once more.

  • 755: a script or program the bot has to run, for example start.sh.
  • 644: a code, configuration or data file.
  • 777: avoid it, this value fixes neither a wrong path nor a read-only system.

Frequently asked questions

What does Error: EACCES: permission denied, open '/root/data.json' mean?

The code opens a file outside the bot folder, often because of an absolute path carried over from another host or from your computer. Replace it with a path built from the script’s folder, as in the example below, then restart the bot.

Why do I get sh: 1: ./start.sh: Permission denied at startup?

The script exists but lacks the execute permission. Give it the value 755 with the “Permissions” action of the “Files” tab, or enter sh start.sh as the “Start command” in the “Startup” tab: the interpreter then reads the script, which no longer needs to be executable.

What should I do about EROFS: read-only file system or npm error code EACCES?

A command is trying to write to the container’s system, typically npm install -g or a write to /usr. No permission can allow that. Declare the package in package.json or requirements.txt: it will be installed in the bot folder at the next start.

Why do I get PermissionError: [Errno 13] Permission denied with Python?

It is the same error as seen by Python. The end of the message gives the refused path: if it does not start with /app, fix the path in the code. If it points to a folder, also check that you are not opening that folder as a file.