How To Hide Processes From Other users in Linux

This post will guide you how to list all running processes from the command line under the Linux operating system. How do I hide your processes from other users in Linux system.

How To Hide Processes From Other users in Linux 1

List All Running Processes


If you want to list all running processes in your Linux system, and you can use any one of the following commands:

$ ps aux

$ top

$ htop

Outputs:

gdm 1908 0.0 0.9 360728 13220 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-datetime
gdm 1913 0.0 0.4 283396 6104 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-housekeeping
gdm 1920 0.2 1.6 502088 21856 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-keyboard
gdm 1926 0.3 1.8 1098592 24560 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-media-keys
gdm 1928 0.0 0.3 203088 4572 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-mouse
gdm 1935 0.3 1.7 601632 23308 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-power
gdm 1939 0.0 0.7 276616 10656 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-print-notifications
gdm 1942 0.0 0.4 203108 5984 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-rfkill
gdm 1949 0.0 0.4 276820 6004 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-screensaver-proxy
gdm 1953 0.0 0.6 306924 8636 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-sharing
gdm 1958 0.1 0.7 457052 10568 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-smartcard
gdm 1962 0.0 0.6 344080 8460 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-sound
gdm 1965 0.3 1.6 511116 22624 tty1 Sl+ 07:07 0:00 /usr/libexec/gsd-wacom
colord 1995 0.1 0.7 323968 10628 ? Ssl 07:07 0:00 /usr/libexec/colord
root 2004 0.0 0.6 325676 8772 ? Ssl 07:07 0:00 /usr/lib/realmd/realmd
gdm 2012 0.0 0.4 206588 5972 tty1 Sl 07:07 0:00 /usr/libexec/ibus-engine-simple
root 2151 0.0 0.0 0 0 ? I 07:07 0:00 [kworker/0:5-events]
root 2157 0.3 0.7 165808 10228 ? Ss 07:08 0:00 sshd: devops [priv]
devops 2165 0.8 0.7 93056 9604 ? Ss 07:08 0:00 /usr/lib/systemd/systemd --user
devops 2173 0.0 0.3 251712 5092 ? S 07:08 0:00 (sd-pam)
devops 2179 0.2 0.6 299112 8608 ? Ssl 07:08 0:00 /usr/bin/pulseaudio --daemonize=no
devops 2180 0.1 0.3 165808 5056 ? S 07:08 0:00 sshd: devops@pts/0
devops 2185 0.3 0.3 24180 4752 pts/0 Ss 07:08 0:00 -bash
devops 2235 0.0 0.3 81424 4828 ? Ssl 07:08 0:00 /usr/bin/dbus-daemon --session --addre

From the above outputs, you can see that the processes owned by the differnt users are listed.

Hide Your Processes From Other users


If you want to hide the display of running processes from other users, and you need to remount /proc file system with a new parameter “hidepid=2“, type the following command:

$ sudo mount -o remount,rw,hidepid=2 /proc

then you can try to run ps command to display all running processes in your Linux system,type:

$ ps aux

Outputs:

[devops@mydevops ~]$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
devops 2923 0.0 0.4 93244 6280 ? Ss 05:52 0:00 /usr/lib/systemd/systemd --user
devops 2939 0.0 0.8 1248768 11900 ? S<sl 05:52 0:00 /usr/bin/pulseaudio --daemonize=no
devops 2950 0.0 0.4 82224 5648 ? Ssl 05:52 0:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation
devops 2956 0.0 0.6 317124 8984 tty2 Ssl+ 05:52 0:00 /usr/libexec/gdm-wayland-session gnome-session
devops 2961 0.0 1.1 708996 15444 tty2 Sl+ 05:52 0:00 /usr/libexec/gnome-session-binary

If you want to make this change permanent, and you need to update your /etc/fstab file for /proc filesystem, and add the following line ito the file:

proc /proc proc defaults,hidepid=2 0 0

save and close the file.

Then you can reboot your Linux system, and then check if the /proc file system is mounted with “hidepid=2” parameter. type:

$ mount | grep hidepid

Outputs:

[devops@mydevops ~]$ mount | grep hidepid
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime,hidepid=2)

Conclusion


You should know that how to hide your running processes from other users through remounting /proc filesystem with “hidepid=2” parameter from the command line in your CentOS or RHEL or Ubuntu system.

You might also like:

Sidebar



back to top