Skip to content

/errors/nmap/scan-type-requires-root-privileges

nmap: You requested a scan type which requires root privileges. QUITTING!

The commands on this page have not been executed by our verification runner yet.updated
tool
Nmap
exit code
1
versions
Nmap 7.x
os
linux, macos

Nmap prints You requested a scan type which requires root privileges. followed by QUITTING! when a scan needs to send raw packets and the process may not open raw sockets. SYN scans (-sS), UDP scans (-sU), OS detection (-O) and similar techniques build packets by hand, which ordinary users cannot do. Run the scan with sudo, or use the TCP connect scan (-sT), which uses the normal connect() system call and needs no privileges.

Which scans need privileges

OptionScanNeeds root or raw-socket rights
-sTTCP connect scanno
-sSTCP SYN scan (default when privileged)yes
-sUUDP scanyes
-sA, -sF, -sN, -sXACK, FIN, NULL, Xmas scansyes
-OOS detectionyes
-sVversion detectionno (with -sT)
-snhost discovery onlyno, but unprivileged discovery uses TCP connects instead of ARP and ICMP

When you run nmap without a scan type as a normal user, it chooses -sT by itself; the error appears only when a privileged type is requested explicitly.

Fixes

bash
# privileged scan of your own host
sudo nmap -sS -p 1-1024 127.0.0.1

# unprivileged alternative
nmap -sT -p 1-1024 127.0.0.1

Linux: capabilities instead of sudo

Nmap can use raw sockets without running as root when its binary has the needed capabilities and you pass --privileged:

bash
sudo setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip "$(command -v nmap)"
nmap --privileged -sS -p 22,80,443 127.0.0.1

Sources