Tried launching a ping with the privileged=False option, but still throws a SocketPermissionError:
>>> ping("8.8.8.8", privileged=False)
Traceback (most recent call last):
File "/home/david/.miniconda3/envs/ping2mqtt/lib/python3.8/site-packages/icmplib/sockets.py", line 88, in __init__
self._sock = self._create_socket(
File "/home/david/.miniconda3/envs/ping2mqtt/lib/python3.8/site-packages/icmplib/sockets.py", line 452, in _create_socket
return socket.socket(
File "/home/david/.miniconda3/envs/ping2mqtt/lib/python3.8/socket.py", line 231, 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/david/.miniconda3/envs/ping2mqtt/lib/python3.8/site-packages/icmplib/ping.py", line 131, in ping
sock = ICMPv4Socket(
File "/home/david/.miniconda3/envs/ping2mqtt/lib/python3.8/site-packages/icmplib/sockets.py", line 97, in __init__
raise SocketPermissionError
icmplib.exceptions.SocketPermissionError: Root privileges are required to create the socket
System details:
OS: Debian 10 buster
Kernel: x86_64 Linux 4.19.0-16-amd64
Python version: 3.8.8 - through miniconda 4.8.4
icmplib version: 2.1.1
Also tried with Python 3.9.4 from within a Docker container, running as root, and when setting the privileged=False setting, the outcome is the same:
>>> from icmplib import ping
>>> ping("8.8.8.8", privileged=False)
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/icmplib/sockets.py", line 88, in __init__
self._sock = self._create_socket(
File "/usr/local/lib/python3.9/site-packages/icmplib/sockets.py", line 452, in _create_socket
return socket.socket(
File "/usr/local/lib/python3.9/socket.py", line 232, 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 "/usr/local/lib/python3.9/site-packages/icmplib/ping.py", line 131, in ping
sock = ICMPv4Socket(
File "/usr/local/lib/python3.9/site-packages/icmplib/sockets.py", line 97, in __init__
raise SocketPermissionError
icmplib.exceptions.SocketPermissionError: Root privileges are required to create the socket
>>> ping("8.8.8.8")
<Host [8.8.8.8]>
Tried launching a ping with the
privileged=False
option, but still throws a SocketPermissionError:System details:
Also tried with Python 3.9.4 from within a Docker container, running as root, and when setting the
privileged=False
setting, the outcome is the same: