Home Linux 执行sudo命令不需要sudo例如nmap
Post
Cancel

Linux 执行sudo命令不需要sudo例如nmap

refer to:
https://www.maketecheasier.com/run-nmap-without-root-or-sudo/

详细原理就不说了,大概就是nmap的一些操作,会用到底层/root权限的某些命令,所以没有sudo,root的权限就不行。

解决办法

sudo apt-get install libcap2-bin

sudo setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip $(which nmap)

运行  (注意这个 --privileged 参数)

nmap --privileged -sS 192.168.0.112

This post is licensed under CC BY 4.0 by the author.
Contents