Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ping: permission denied (are you root?) #253

Closed
michaeljs1990 opened this issue Feb 9, 2017 · 2 comments
Closed

ping: permission denied (are you root?) #253

michaeljs1990 opened this issue Feb 9, 2017 · 2 comments
Labels

Comments

@michaeljs1990
Copy link

michaeljs1990 commented Feb 9, 2017

I can't run ping if i am not the root user. In my case I am running a program that is running ping as the apache user. The service is started with a uid of 0 however the apache user is not able to run ping.

an easy fix is chmod u+s /bin/ping however I feel like this should be something that makes it's way upstream.

To reproduce you can do build this dockerfile https://github.com/michaeljs1990/phpipam/blob/dockerfile/Dockerfile and then exec into it make a lol.php file in the working dir and use this script.

<?php

exec('/bin/ping -c 5 -w 5 192.168.1.5 2>&1', $output);
var_dump($output);

and go go lol.php.

michaeljs1990 added a commit to michaeljs1990/phpipam that referenced this issue Feb 9, 2017
@ncopa
Copy link
Collaborator

ncopa commented Mar 7, 2017

You need to set net.ipv4.ping_group_range on your host to enable unprivileged icmp sockets.

see for example: https://sturmflut.github.io/linux/ubuntu/2015/01/17/unprivileged-icmp-sockets-on-linux/

@andyshinn
Copy link
Contributor

Alternatively, you can install the iputils package to use the non-BusyBox ping which has the correct permissions you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants