Prevent users from seeing processes that do not belong to them

hidepid option :- this can be done by hidepid option which have below values :-

hidepid=0 -  anybody may read all world-readable /proc/PID/* files (default).
hidepid=1 -  It means users may not access any /proc/ */ directories, but their own.
hidepid=2  - It means hidepid=1 plus all /proc/PID/ will be invisible to other users.


Type the following mount command:
# mount -o remount,rw,hidepid=2 /proc

To make above configuration across the reboot , edit /etc/fstab for the same :
# vi /etc/fstab

update proc entry with hidepid=2 as below

proc    /proc    proc    defaults,hidepid=2     0     0

If you want yo give access to particular group to see all process (hidepid=0 mode), you need to use gid=<group_name> option:

proc /proc proc defaults,hidepid=2,gid=admin 0 0


You can confirm this hidepid value after remount as below :-

#mount | grep -i proc

Comments

Popular posts from this blog

HP-UX virtual Machine Cheat Sheet

How to run fdisk in non-interactive mode