process.setgroups(groups)


process.setgroups() 方法为 Node.js 进程设置补充群组 ID。 这是一个特权操作,需要 Node.js 进程具有 rootCAP_SETGID 能力。

此功能仅适用于 POSIX 平台(即不适用于 Windows 或安卓)。 此特性在 Worker 线程中不可用。

The process.setgroups() method sets the supplementary group IDs for the Node.js process. This is a privileged operation that requires the Node.js process to have root or the CAP_SETGID capability.

The groups array can contain numeric group IDs, group names or both.

This function is only available on POSIX platforms (i.e. not Windows or Android). This feature is not available in Worker threads.