首页 Function Compute Function Compute FAQ Function invocations What do I do if data cannot be written to a non-/tmp directory?

What do I do if data cannot be written to a non-/tmp directory?

更新时间: 2026-04-01 03:38:54

In most cases, data cannot be written to a non-/tmp directory because the function instance is started by a non-root user. Two configurations can cause a function instance to start as a non-root user:

  • The function was created before August 2022.

  • The Apsara File Storage NAS (NAS) configuration uses a non-root user ID or user group ID.

Cause 1: Function created before August 2022

Functions created before August 2022 run as a non-root user with a user ID (UID) of 10000 or higher by default. Because the file system is owned by root, writes to non-/tmp directories fail.

For details on when this default changed, see August 2022 release notes.

Solution

Create a new function and migrate your code and configurations to it. New functions run as root (UID=0) by default and can write to all directories.

Cause 2: NAS configuration uses a non-root user ID or user group ID

When you mount a NAS file system, Function Compute starts the function instance using the user ID and user group ID specified in the NAS configuration. If either value is non-zero, the instance runs as a non-root user and cannot write to non-/tmp directories.

Solution

In the NAS configuration, set the user ID to root (UID=0) and the user group ID to root group (GID=0). This makes function instances run as root and grants write access to all directories.

For configuration steps, see Configure a NAS file system.

上一篇: Why does the first letter of the header key become uppercase when I use an HTTP trigger to invoke a function? 下一篇: Function instances
阿里云首页 函数计算 相关技术圈