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 requires root privileges #28

Closed
seriousm4x opened this issue Jan 19, 2021 · 1 comment
Closed

ping requires root privileges #28

seriousm4x opened this issue Jan 19, 2021 · 1 comment

Comments

@seriousm4x
Copy link

seriousm4x commented Jan 19, 2021

I'm using debian 10 with python3 3.7.3 and pinging doesn't work without being root. This is what I've tried:
Package version is 2.0.1

Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from icmplib import ping
>>> test = ping("8.8.8.8", count=1, interval=1, timeout=1, privileged=False)
Traceback (most recent call last):
  File "/home/max/.local/lib/python3.7/site-packages/icmplib/sockets.py", line 88, in __init__
    socket.SOCK_DGRAM)
  File "/home/max/.local/lib/python3.7/site-packages/icmplib/sockets.py", line 448, in _create_socket
    proto=socket.IPPROTO_ICMP)
  File "/usr/lib/python3.7/socket.py", line 151, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/max/.local/lib/python3.7/site-packages/icmplib/ping.py", line 133, in ping
    privileged=privileged)
  File "/home/max/.local/lib/python3.7/site-packages/icmplib/sockets.py", line 95, in __init__
    raise SocketPermissionError
icmplib.exceptions.SocketPermissionError: Root privileges are required to create the socket
>>>

Edit: It works on my other ubuntu server with python 3.8.5.

@seriousm4x
Copy link
Author

Reading the doc helps... I ran sudo sysctl -w net.ipv4.ping_group_range='0 2147483647' and its working now. Sorry...

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

No branches or pull requests

1 participant