0

Why can't I see the 'ping' process in my 'ps' listing when I started it as a regular user?

The ping binary has setuid bit,

 ls -l /bin/ping
-rwsr-xr-x 1 root root 64424 jun 28  2019 /bin/ping

Running ping in the background,

ping google.com > /dev/null &
[1] 28193

When I look for this process using ps as my user(enn) I don't find it,

 ps -ef  | grep 28193

Whereas if I use superuser, I can find it,

sudo ps -ef | grep 28193 | grep -v grep
enn  28193  6878  0 13:49 pts/3    00:00:00 ping google.com

Using ps to print the associated IDs and I could see the ping process is running with my {u,e,r}id/{g,e,r}id = 66973, 64000

The only difference I could see is in the suid, which is set to 0

sudo ps -e -o pid,uid,gid,euid,egid,ruid,rgid,suid,sgid,cmd | grep 28193 | grep -v grep

28193 66973 64000 66973 64000 66973 64000     0 64000 ping google.com

I am not able to understand the reason for this, Could someone help me understand what I can't see the process as a regular user?

System Info: "Ubuntu 18.04.6 LTS"

Thanks in advance, Naga

1
0

Works just fine here (Fedora 34). Run ping 8.8.8.8 on one tab of my Gnome terminal, on another:

$ pgrep ping
295323
$ ps -ef | grep 295323 
user  295323    3772  0 18:50 pts/4    00:00:00 ping 8.8.8.8
user  295628    3726  0 18:53 pts/3    00:00:00 grep --color=auto 295323

Are you sure you didn't copy the PID wrong (happens to me around half of the time)? Is ping still running (it stops dead if it doesn't find the target, for example)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.