You are not logged in.
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
Can't reproduce the issue here so it is probably local to you.
My guess: It has to do with the VPN.
Offline
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