When using Linux the /proc
filesystem can be remounted with additional arguments:
mount -o remount,rw,hidepid=2 /proc
hidepid=1
hides all processes information but not the process
itself from other users, except root
.
hidepid=2
hides all processes from other users, except root
.
Reasons not using hidepid=2:
This can be a problem for a lot of system and monitoring tools, which are executed with a specific user. Those tools should not run as root user.
For example, you are using htop
to monitor your whole system, htop
needs to be run as root
user or with sudo
to get the right privileges.
In a corporate network tools like Monit
or Nagios
are installed on servers and each tool has it's own user.
Using hidepid can result in using root accounts more often and this can result in a higher risk to get compromised.
Advantages when using hidepid=1 or hidepid=2:
The system becomes harder to compromise. For example you have a shared server and other users can connect via ssh to this server. Each user can access all processes and read process information.
Some applications can be started with username and password as an argument. Those information can be read by any user. Using hidepid=1 or hidepid=2 hides this information from other users.
Conclusion:
Using hidepid
can improve the security, but you have to know the disatvantages. For most users and systems it's not necessary to hide the information.
For example, if you have a single user system (desktop) you have already root privileges and it's likely, that you are the only user working on this system.
A dedicated company webserver should allow ssh logins only for system administrators and most of them needs root privileges for administrative tasks.
There are also some best practices which can reduce the risk of information lost. You should never provide a password as a command line argument. Most applications provide a dedicated prompt to enter the password. If you need the application in a batch job, you should use configuration files, which are only accessible by the service user, to configure credentials.