Thomas' Tech Tips

Fix ping for regular users in Linux

13 March 2022 - Thomas Damgaard

For some reason, on one of my Debian VMs I got this error when running ping somehost as a regular user:

ping: socket: Operation not permitted

I could sudo ping just fine. But ping should work for regular users.

It turns out, the fix is quite easy. To fix this, run:

sudo setcap cap_net_raw=ep /bin/ping

Hopefully, this tip can save some time for someone else in the same situation.

Filed under: linux, ping, tips