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

ERROR 'Operation not permitted' inside Docker as user #109

Open
i-m-d opened this issue Oct 23, 2023 · 0 comments
Open

ERROR 'Operation not permitted' inside Docker as user #109

i-m-d opened this issue Oct 23, 2023 · 0 comments

Comments

@i-m-d
Copy link

i-m-d commented Oct 23, 2023

Describe the bug
ERROR 'Operation not permitted' inside Docker

from pythonping import ping
ping('8.8.8.8', verbose=True)

To Reproduce

  1. run docker container

$ docker run -it --rm --name pithon_ping python:3.9-slim bash

  1. install module

root@814557ae73c5:/# pip3 install pythonping
Collecting pythonping
Downloading pythonping-1.1.4-py3-none-any.whl (16 kB)
Installing collected packages: pythonping
Successfully installed pythonping-1.1.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip

  1. create user

root@814557ae73c5:/# useradd test

  1. change to user

root@814557ae73c5:/# su - test
su: warning: cannot change directory to /home/test1: No such file or directory

  1. test ping as user

$ python3
Python 3.9.18 (main, Sep 7 2023, 13:33:59)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from pythonping import ping
ping('8.8.8.8', verbose=False)
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.9/site-packages/pythonping/init.py", line 81, in ping
comm = executor.Communicator(target, provider, timeout, interval, socket_options=options, verbose=verbose, output=out,
File "/usr/local/lib/python3.9/site-packages/pythonping/executor.py", line 293, in init
self.socket = network.Socket(target, 'icmp', options=socket_options, source=source)
File "/usr/local/lib/python3.9/site-packages/pythonping/network.py", line 31, in init
self.socket = socket.socket(socket.AF_INET, socket.SOCK_RAW, self.protocol)
File "/usr/local/lib/python3.9/socket.py", line 232, in init
_socket.socket.init(self, family, type, proto, fileno)
PermissionError: [Errno 1] Operation not permitted

quit()
$ exit

  1. test as root

root@814557ae73c5:/# python3
Python 3.9.18 (main, Sep 7 2023, 13:33:59)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from pythonping import ping
ping('8.8.8.8', verbose=False)
Reply from 8.8.8.8, 29 bytes in 1.93ms
Reply from 8.8.8.8, 29 bytes in 1.73ms
Reply from 8.8.8.8, 29 bytes in 1.5ms
Reply from 8.8.8.8, 29 bytes in 1.53ms

Round Trip Times min/avg/max is 1.5/1.67/1.93 ms

Expected behavior
work as user and root

Screenshots
NONE

Desktop (please complete the following information):

  • OS: Debian 11
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