SolvedDietPi ping: socket: Operation not permitted



echo 'net.ipv4.ping_group_range = 0 2147483647' > /etc/sysctl.d/99-ping.conf
sysctl -p /etc/sysctl.d/99-ping.conf

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?

dietpi@DietPi:~$ ping
ping: socket: Operation not permitted
dietpi@DietPi:~$ sudo ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=1.05 ms

Is there a special reason for this or is this a bug?

18 Answers

✔️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"

Related Issues:

DietPi ping: socket: Operation not permitted
This seems to be working here ADMIN EDIT Solution Read more
DietPi DietPi-Software | Kodi on RPi Buster fails to start
some information: Kodi is back on official rpi repo ADMIN EDIT Bug does not apply anymore since Kodi...
DietPi DietPi-Software | NextCloudPi convergence
Thanks both I just saw this thread comparing the two projects and see no reason you could not furthe...
DietPi Upgrade v6.25.3 -> v.6.30.0 fails: /DietPi/dietpi/func/dietpi-ramdisk: No such file or directory
Found it please do not do any of the mentioned steps the error can and should be ignored As can be s...
DietPi Image | Odroid HC4
Not partitioning just a mountpoint They created /media/boot as an empty folder and mount the bootfs ...
nvm .nvmrc example?
If you're currently using the Node version you want for .nvmrc you can run this command: node -v > ....
nvm -bash: nvm: command not found
I had the same issue until I added the following lines to my .bash_profile Running terminal in Mac O...
nvm nvm install node fails to install on macOS Big Sur M1 Chip
For anything under v15 you will need to install node using Rosetta 2 You can do this by running the ...
rbenv 'find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
Can you try with gem i bundler -v 1.17.3 and bundle i on your project directory? ...
nvm How to uninstall nvm?
@mibamur There is no need for such emphasis in your comments And it is probably better to use the $N...
nvm NVM is not compatible with the npm config "prefix" option warning (OS X)
nvm unalias default worked for me! Much appreciated @MwumLi 🍻 Split off from #855 ; see that issue ...
powerline Update MacOS to Mojave, then vim get error with powerline
SOLUTION!! Figure out your current vim version Mine was not compiled with homebrew but was the defau...
nvm NVM fails to load within nested shell
For me Operating system and version: macOS High Sierra 10.13.1 (17B48) nvm debug output: nvm ls outp...
screenFetch awk: fatal: cannot open file `proc/fb' for reading on Ubuntu 18.04 for Windows 10
Downlode the latest version from here wget -O screenfetch-dev Then sudo rm /usr...
nvm "nvm use" not persisting
nvm use isn't meant to persist - it's only for the lifetime of the shell Sorry I'm sure this is a du...
nvm nvm is not compatible with the "PREFIX" environment variable: currently set to "/usr/local"
No need to unset anything.. This behavior happens when you have more than 1 installation of npm/yarn...
wslu Cannot create directory "//.cache": Permission denied
Hello Here an improved version Background Information: Build: 17763 WSL: Ubuntu 18.04.03 Version: ws...
nvm How to update npm?
nvm install-latest-npm Attempt to upgrade to the latest working npm on the current node version ...
nvm nvm prefix error appears in VS Code terminal only when default alias is present
I think i see the problem - you don't have a system node installed Operating system and version: Mac...
rbenv yarn shim can't seem to find installed yarn
The yarn shim was added to rbenv because one of the Ruby versions has for some reason a yarn executa...
shelljs 0.8.3 high severity vuln
I'm in communication with Snyk right now Node version (or tell us if you're using electron or some o...
liquidprompt ERROR: Can't get value of subfeature temp1_input: Can't read
I sympathize with @dolmen but the proper fix is to fix the lm-senors so it ignores the troublesome c...
nvm nvm install fails complaining about prefix, despite not being set
I had this issue for the past week and I finally sat down and took two hours to fix this Here is wha...
nvm .nvmrc for projects
I would pay 2$ if somebody implements this feature. It would be nice if we had a .nvmrc file for a p...
shellcheck SC1090/SC1091: sourcing should find files relative to script
@koalaman I can see the argument that the behaviour as it stands could be useful in some edge cases ...
babashka clojure.core.match
Just chiming in to say I'm also interested in using clojure.core.match with babashka! ...
nvm sourcing is slow even with --no-use
I use this for zsh: I start up a lot of terminal windows on my Mac and for some reason the commands ...
gitstatus gitstatus failed to initialize
@romkatv Steps Taken: cd ~/.oh-my-zsh/custom/themes/powerlevel10k git stash git pull Opened new term...
shc Executable does not work...
The problem lies in chkenv This uses the address of itself to compose a name of an environment varia...
nvm NVM command not found after terminal restart.
I am still facing the issue pls help? run source ~/.nvm/ and if it doesnt work after you close...
nvm parse error near `done'
omg i found it I had set up an alias to connect to my digital ocean server: can't believe it didn't ...
nvm OSX Sierra node installation failed; Checksums does not match.
@PeterDaveHello thanks for taking a look just figured that out I just didn't copy the second line of...
nvm Manjaro: `nvm is not compatible with the npm config "prefix" option: currently set to ""`
I figured this out on my system For other Arch/Manjaro users here's how you can find the cause: Inst...
direnv fish: direnv is no longer triggered on shell creation
I'm chiming in as a fish user but I didn't know about the directory arrow shortcuts before reading t...
nvm bashrc NVM EACCES: permission denied upon switching user
I was struggling to find a fix for this error but as @ljharb mentionned you should cd ~ BEFORE the n...
rbenv Ruby 2.4.1 build failed on macOS High Sierra 10.13.2
I have had the same issue but I am able to fix it by doing the following steps: sudo mv /usr/local/i...
nvm NVM not adding node_modules to path
@Gerst20051 @ljharb Because
nvm NVM installed, getting GLIBC err on node install
I got the exact same error while trying to install node with nvm Operating system and version: linux...
fzf Revising ranking algorithm
I just released 0.15.0 with --algo=[v1|v2] option where v2 is the default You can use v1 if the perf...
nvm Globally installed cli packages not available after NPM install
save-prefix is fine altho ^ (the default) is better - but prefix definitely needs to be deleted Now ...
powerline powerline-status crashes with ipython>=7.0.0
Until the changes are released checkout the develop branch to get them It may be less stable than ma...
dockerfiles Chrome 79 white screen
Issue-Label Bot is automatically applying the label bug to this issue with a confidence of 0.79 ...
nvm nvm install node not working on "ubuntu on windows"
Hey everyone.. just so you're all aware this isn't an nvm issue nor a Ubuntu issue nor a Windows iss...
yadm Can I use this to track system level files?
Managing files outside of your home directory isn't really within the standard use-case for yadm ...
bash language server Install error Failed at the tree-sitter@0.13.23 install script
Update: This fixed the issue here on Arch Linux along with --unsafe-perm:
3 Cloudflare DNS broken - is this really the fix?
I was about to open the exact same issue! 😅 I had been using an older version; today I deci...
nvm `sort` command not found
Hi I actually found the source of the problem I'm using 'bash strict mode' The change of the field s...
m cli Installed but won't work
@Strandbummler I found out that my PATH is in .bash_profile not .profile So I changed @blahah 's com...
howdy Error when adding a face (since Ubuntu 20.04)
For newbies: I checked which device was the IR camera using ffmpeg Mine was /dev/video2 ...
uwsgi nginx flask docker Raspberry pi: standard_init_linux.go:190: exec user process caused "exec format error"
Thanks for the help! That solves it! Just for posterity these are the commands I ran from start to f...