2

It seems that htop shows all running processes to every user, and process names in htop contain all the file names that I include in the command line. Since I usually use very long file names that actually contains a lot of detailed information about my project, I do not want such information to be visible to every one (but I am OK that other users see what software that I am running).

How can I hide the details in the process name?

Amal Murali
  • 75,622
  • 18
  • 128
  • 150
Feng
  • 21
  • 1
  • 3
  • If you want to hack Linux, you can do this. But otherwise, the concept goes against the Unix/Linus philosophy of being transparent. http://unix.stackexchange.com/questions/17164/how-to-make-a-process-invisible-to-other-users – Giacomo1968 Jun 01 '14 at 03:13
  • 1
    before running processes with sensitive information in their paths, you can 'cd' in to the directory where the executables live and run the programs from there. htop only shows the relative directory – gilsho Jun 01 '14 at 03:13
  • Also: http://stackoverflow.com/questions/6046676/hiding-command-line-arguments-for-c-program-in-linux – rici Jun 01 '14 at 03:24
  • This is not Linux specific: it applies to *BSD and solaris as well. There is even a good answer for *BSD. – Good Person Jun 01 '14 at 05:57

1 Answers1

0

How can I hide the details in the process name?

Since kernel 3.3, you can mount procfs with the hidepid option set to 1 or 2.

The kernel documentation file proc.txt describe this option:

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.

Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240