SolvedDietPi ping: socket: Operation not permitted

ADMIN EDIT

Solution

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 192.168.88.14
ping: socket: Operation not permitted
dietpi@DietPi:~$ sudo ping 192.168.88.14
PING 192.168.88.14 (192.168.88.14) 56(84) bytes of data.
64 bytes from 192.168.88.14: 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:

29
DietPi ping: socket: Operation not permitted
This seems to be working here ADMIN EDIT Solution Read more https://fedoraproject.org/wiki/Changes/E...
5
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...
3
DietPi DietPi-Software | NextCloudPi convergence
Thanks both I just saw this thread comparing the two projects and see no reason you could not furthe...
3
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...
3
DietPi Image | Odroid HC4
Not partitioning just a mountpoint They created /media/boot as an empty folder and mount the bootfs ...
752
nvm .nvmrc example?
If you're currently using the Node version you want for .nvmrc you can run this command: node -v > ....
744
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...
627
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 ...
294
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? ...
287
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...
179
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 ...
132
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...
130
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...
118
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 https://git.io/vaHfR Then sudo rm /usr...
100
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...
88
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...
65
wslu Cannot create directory "//.cache": Permission denied
Hello Here an improved version Background Information: Build: 17763 WSL: Ubuntu 18.04.03 Version: ws...
62
nvm How to update npm?
nvm install-latest-npm Attempt to upgrade to the latest working npm on the current node version ...
62
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...
44
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...
37
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...
30
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...
19
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...
18
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...
17
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 ...
16
babashka clojure.core.match
Just chiming in to say I'm also interested in using clojure.core.match with babashka! ...
16
nvm sourcing nvm.sh 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 ...
16
gitstatus gitstatus failed to initialize
@romkatv Steps Taken: cd ~/.oh-my-zsh/custom/themes/powerlevel10k git stash git pull Opened new term...
14
shc Executable does not work...
The problem lies in chkenv This uses the address of itself to compose a name of an environment varia...
14
nvm NVM command not found after terminal restart.
I am still facing the issue pls help? run source ~/.nvm/nvm.sh and if it doesnt work after you close...
14
nvm nvm.sh:114: 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 ...
13
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...
13
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...
12
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...
12
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...
12
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...
11
nvm NVM not adding node_modules to path
@Gerst20051 @ljharb Because https://nodejs.org/api/modules.html#modules_loading_from_the_global_fold...
11
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...
9
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...
9
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 ...
9
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...
5
dockerfiles Chrome 79 white screen
Issue-Label Bot is automatically applying the label bug to this issue with a confidence of 0.79 ...
5
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...
4
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 ...
4
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: https://wiki.archlinux.org...
3
acme.sh Cloudflare DNS broken - is this really the fix?
I was about to open the exact same issue! 😅 I had been using an older acme.sh version; today I deci...
3
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...
3
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...
22
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 ...
15
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...