SolvedDietPi ping: socket: Operation not permitted
✔️Accepted Answer
This seems to be working here
sudo setcap 'cap_net_admin,cap_net_raw+ep' $(which ping)
Other Answers:
sudo setcap 'cap_net_admin,cap_net_raw+ep' $(which ping)
This is probably the correct answer.
Doing a sudo ping <host>
is probably what the kernel developers intended you to do since it's not really supposed to be run by normal users but it's pretty much considered an everyday tool these days and sudoing every time is a bit of a pain.
Adding the 'setuid' bit with chmod +s /bin/ping
is what most Linux distros seem to do but it's a bit of a security concern because it grants ALL the rights of a super user.
The setcap
approach grants much more restricted rights by only allowing it the specific capabilities it needs.
Find the location of the ping binary in case it's not normal using "type ping". Then give it privileges to use as non root user "chmod +s /bin/ping" or "chmod +s /location/of/ping"
use the following command.
sudo ping "your ip addr or host name"
ADMIN EDIT
Solution
Read more
Hi there,
It seems for some reason DietPi is set up in a way where a normal user cannot perform a ping operation?
Is there a special reason for this or is this a bug?