linux 修改任务和CPU共享的权限被拒绝

mzsu5hc0  于 12个月前  发布在  Linux
关注(0)|答案(1)|浏览(119)

作为一个实验,我试图在tasks中添加一些进程并修改一些cpu.shares
我在/sys/fs/cgroup/cpu中创建了一个文件夹test

$ sudo -s
$whoami
root

$ echo 2472 > tasks
-bash: tasks: Permission denied

$sudo echo 10 > cpu.shares
-bash: cpu.shares: Permission denied

字符串
此外,文件夹的ls不显示这2个文件。(因为任务文件中没有PID??)
此外,如果我尝试删除test文件夹,我不能.我得到的错误

rm: cannot remove 'test/cgroup.events': Operation not permitted
rm: cannot remove 'test/io.pressure': Operation not permitted
rm: cannot remove 'test/cgroup.procs': Operation not permitted
rm: cannot remove 'test/cgroup.max.descendants': Operation not permitted
rm: cannot remove 'test/cpu.stat': Operation not permitted
rm: cannot remove 'test/memory.pressure': Operation not permitted
rm: cannot remove 'test/cpu.pressure': Operation not permitted
rm: cannot remove 'test/cgroup.type': Operation not permitted
rm: cannot remove 'test/cgroup.stat': Operation not permitted
rm: cannot remove 'test/cgroup.threads': Operation not permitted
rm: cannot remove 'test/cgroup.kill': Operation not permitted
rm: cannot remove 'test/cgroup.freeze': Operation not permitted
rm: cannot remove 'test/cgroup.controllers': Operation not permitted
rm: cannot remove 'test/cgroup.subtree_control': Operation not permitted
rm: cannot remove 'test/cgroup.max.depth': Operation not permitted


但是,为什么我不能编辑这些文件或删除这个创建的文件夹?我试图运行命令作为root用户操作系统:Ubuntu 22.04.1

tsm1rwdh

tsm1rwdh1#

这可能对任何遇到同样问题的人都有帮助。我通过运行“rmdir”而不是“rm”来修复它。

相关问题