Take the 2-minute tour ×

When I use as root

nmap -sP -n hostaddress 

I get the mac address of the hostaddress device

but when I change to a different user with less privileges I do not get the mac address as a return.

What can I do so that the under privileged user can get the mac address returned from NMAP

share|improve this question
add comment

2 Answers

Per NMAP.org, many kinds of scans may require root access. this is because standard users are constrained in the instructions they can give to a NIC by the kernel. It is a seriously bad idea to try to lift those restrictions.

share|improve this answer
The user is for network monitoring. If there are ways of allow this please let me know. From what you are saying there are ways to do such things. –  jenglee Nov 28 '12 at 18:23
with linux, there is a way to do almost anything, but tweaking and compiling kernel code is beyond me. I don't know centos very well, but does it use sudo by default? if so, edit the sudoers file so that the app is automatically allowed elevation when your specific user runs it. –  Frank Thomas Nov 28 '12 at 19:11
add comment

Nmap uses different techniques when running as an unprivileged user. Specific to this question, root can sniff traffic from the network, which is how Nmap detects the target's MAC address. Unprivileged users are unable to sniff network traffic or use raw sockets.

It is absolutely critical that you do NOT install Nmap setuid root to allow normal users to run it. It is trivial to manipulate Nmap into running arbitrary commands as root when it is installed setuid.

share|improve this answer
Well it is not a normal user that I want to run it on. I have a user that is running network checks that will be using this command. Can you please tell me why I should not have a unprivileged user be able to sniff network traffic –  jenglee Nov 28 '12 at 19:54
It's not about what you should do, it's about what you can do. Linux does not allow regular users to sniff network traffic. You can get around it with capabilities, but Nmap doesn't support those officially –  bonsaiviking Nov 28 '12 at 21:26
add comment

Your Answer


