gpt4 book ai didi

linux - 在 htop 中更改或隐藏进程名称

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:09:16 53 4
gpt4 key购买 nike

似乎 htop 向每个用户显示所有正在运行的进程,并且 htop 中的进程名称包含我在命令行中包含的所有文件名。因为我通常使用非常长的文件名,实际上包含了很多关于我的项目的详细信息,所以我不希望每个人都能看到这些信息(但我可以让其他用户看到我正在运行的软件)。

如何隐藏进程名称中的详细信息?

最佳答案

How can I hide the details in the process name?

从内核 3.3 开始,您可以挂载 procfshidepid 选项设置为 12

内核文档文件proc.txt描述这个选项:

The following mount options are supported:

hidepid= Set proc access mode.

hidepid=0 means classic mode - everybody may access all /proc directories (default).

hidepid=1 means users may not access any /proc directories but their own. Sensitive files like cmdline, sched*, status are now protected against other users. This makes it impossible to learn whether any user runs specific program (given the program doesn't reveal itself by its behaviour). As an additional bonus, as /proc//cmdline is unaccessible for other users, poorly written programs passing sensitive information via program arguments are now protected against local eavesdroppers.

hidepid=2 means hidepid=1 plus all /proc will be fully invisible to other users. It doesn't mean that it hides a fact whether a process with a specific pid value exists (it can be learned by other means, e.g. by "kill -0 $PID"), but it hides process' uid and gid, which may be learned by stat()'ing /proc// otherwise. It greatly complicates an intruder's task of gathering information about running processes, whether some daemon runs with elevated privileges, whether other user runs some sensitive program, whether other users run any program at all, etc.

关于linux - 在 htop 中更改或隐藏进程名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23976420/

53 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com