I'm trying to limit the CPU usage of a process using cgroups v2. The hierarchy is already created and the limits are set, I just need to write the pid into the cgroup.procs file. The path is
/sys/fs/cgroup/system.slice/myfolder/myfolder/myfolder/cgroup.procs. All the myfolders' permissions are
drwxr-xr-x myuser mygroup. The permissions of the cgroup.procs file are
-rwxrwxrwx myuser mygroup. Yet, when trying to execute the following command:
sudo -H -u myuser bash -c 'echo some_existing_pid > /sys/fs/cgroup/system.slice/myfolder/myfolder/myfolder/cgroup.procs'
I get the following error:
bash: line 1: echo: write error: Permission denied
What can be a possible reason for that?
OS: Ubuntu 22.04