Home / How to hide processes from other users in ps and top in CentOS Server?

How to hide processes from other users in ps and top in CentOS Server?

The hidepid option in RHEL has the value 0 by default. This implies that all data is visible to every user. The directory entries in /proc will remain visible but inaccessible when set to 1.
To keep the data hidden from /proc, set the value to 2.

Run the following command to instantly apply the changes.

 # mount -o remount,rw,hidepid=2 /proc

For long-term adjustments, Add the hidepid=2 option to the proc filesystem in /etc/fstab and remount the partition by using the following mount command.

 # mount -a

The /proc entry in /etc/fstab is shown below.

proc /proc proc hidepid=2 0 0

Every Linux distribution provides the default setting of revealing ReadOnly processes to other users. This is mostly about privacy and has nothing to do with security. The idea that a timesharing system would be an open community is outdated.

Use containerization if a process needs to run and presents a potential attack surface. It has its own PID namespace in addition to the network, mount, user, UTS (hostname and NIS domain name) namespaces, cgroup, and root file tree.

Leave a Reply