You are not logged in.

#1 2025-03-12 13:16:48

hell0_12
Member
Registered: 2024-12-08
Posts: 1

Nmap Shows "0 Hosts Up" with sudo, Works Without It

Issue:
When running nmap without sudo, it works fine and detects live hosts. However, when I run nmap with sudo, it always reports 0 hosts up, even if the target is reachable (ping works).

What I Tried:
Running nmap with -Pn to skip host discovery (sudo nmap -Pn <target-ip>) → Still reports 0 hosts up
Checking firewall (sudo ufw status, sudo iptables -L -v -n) → Firewall is disabled
Running nmap with -e <interface> to specify the correct network interface → No difference
Checking AppArmor (sudo aa-status) and SELinux (sestatus) → Both are not enforcing
Running nmap as root (sudo su -c 'nmap <target-ip>') → Still fails
Running sudo tcpdump -i <interface> host <target-ip> while scanning → No packets are being sent
Checking raw sockets (lsmod | grep raw) and manually loading af_packet (sudo modprobe af_packet) → No change
System Info:
Distro: Arch Linux
Kernel: 6.12.7-arch1-1-surface
Nmap version: 7.95
Network Interface: wlan0 but tun0 with vpn(protonvpn via openvpn)

Offline

#2 2025-03-14 08:28:06

ReDress
Member
From: Nairobi
Registered: 2024-11-30
Posts: 133

Re: Nmap Shows "0 Hosts Up" with sudo, Works Without It

Can't reproduce the issue here so it is probably local to you.

My guess: It has to do with the VPN.

Offline

#3 2025-03-14 10:30:15

seth
Member
Registered: 2012-09-03
Posts: 62,873

Re: Nmap Shows "0 Hosts Up" with sudo, Works Without It

sudo nmap -e wlan0 _gateway
sudo ping -c3 -I wlan0 _gateway
sudo nmap -e tun0 _gateway
sudo ping -c3 -I tun0 _gateway

Several nmap features require elevated privileges, but there's no restriction the other way round, so the reason is that the root sees a differnet network.

Offline

Board footer

Powered by FluxBB