Privilege Error

Hello guys , anybody can help me with this error?? I have a view that use multiping but when I call the view I receive this error , anybody knows how to solve it?

Thanks and sorry for my English :smiley:

MultiPingError at /Ar

Root privileges required for sending ICMP

Request Method: GET
Request URL:
Django Version: 3.0.5
Exception Type: MultiPingError
Exception Value:

Root privileges required for sending ICMP

Exception Location: /home/ramiro/.local/lib/python3.8/site-packages/multiping/ in _open_icmp_socket, line 175
Python Executable: /usr/bin/python3
Python Version: 3.8.2
Python Path:


Server time: Sun, 3 May 2020 11:34:45 -0300

Your application is using a module called multiping. In its documentation it says that you need to run the application as root/admin in order to use some functionality. In other words, run your application with more rights, such as “run as admin” on windows.

Yep I know it but I am running Django with a user with root privileges , I am using Ubuntu . So I dont know what more I have to add to permit multiping work from a user that is not root . (My user is in sudoers file)

How are you running multiping in your view? If you’re running it directly, you could run the sudo program itself, passing multiping in as a parameter. (You’ll need to set your sudoers file to allow the account running Django to run multiping without a password.)

Hello Ken, I am runining multiping directly in a function , I already have my sudoers file like this
ramiro ALL=(ALL:ALL) ALL

But the problem is the same , I think the problem is that cannot open ICMP socket , but I dont know how to fix it :expressionless: :

I would need to see the view code that is running the multiping command.

For example, If you’re running multiping directly, you could change it to run ‘sudo multiping’

This is the code
from multiping import MultiPing

def manila():
cores = [“”, “”, “”, “”, “”]
mp = MultiPing(cores)
responses, no_responses = mp.receive(1)
hostUP= (list(responses))

Ah, ok, you’re running the python multiping library. I was working under the assumption that you were calling an external program by that name.
The misunderstanding was mine. In this case, I’m going to agree with JonasKs’ answer. You either need to run your entire application as root. (Note, this means actually running it as root, not just as an account with root access.) Or, you need to externalize this code into a separate script, and then run that script from your view using the sudo command.

Thanks Ken and JonasKs, as you said , I had to run the app as root.

Thanks for your time , I really appreciated it.