Couldn't open a raw socket. Error: Permission denied (13)

14,016

Solution 1

Did you install nmap using:
$ sudo snap install nmap
or
$ sudo apt install nmap
I had this same issue, I installed using snap and was getting the same error as you. If that is the case remove the snap install and use apt:
$ sudo snap remove nmap
$ sudo apt install nmap

run a command with nmap, if you get the error:
bash: /snap/bin/nmap: No such file or directory
use the following command to let go of the cached link:
hash -r
run nmap again,this worked for me.

How I got my answer.

Solution 2

You have to grant network access to nmap with: snap connect nmap:network-control

Share:
14,016

Related videos on Youtube

Marek Mudron
Author by

Marek Mudron

Updated on September 18, 2022

Comments

  • Marek Mudron
    Marek Mudron over 1 year

    I am trying to get familiar with hacking and networking by doing HackTheBox challenges. At starting point Oopsie I am supposed to use command nmap -sS -A 10.10.10.28. However, after running it in Ubuntu 20.04 I got following error: Starting Nmap 7.91 ( https://nmap.org ) at 2021-01-25 20:07 CET Couldn't open a raw socket. Error: Permission denied (13). At https://github.com/microsoft/WSL/issues/2039 I read, that this feature is not implemented in nmap. Is there any way to open a raw socket in my operating system with this tool?

    • NotTheDr01ds
      NotTheDr01ds over 3 years
      You link to a WSL issue - Are you running WSL (Windows Subsystem for Linux? If so, this is critical information to someone trying to answer your question, and you should mention it and tag it as windows-subsystem-for-linux. Note that the issue you linked to says that support for raw sockets is limited in WSL, not in nmap (which is what you said in your question).
  • mdikici
    mdikici over 2 years
    Works like a charm :)
  • Admin
    Admin about 2 years
    thanks that fixed my system Ubuntu 21.10