I'm trying to programatically call traceroute on Ubuntu but i'm getting blocked when trying to use the -I or -T flags for ICMP/TCP packets.

Accroding to this question I can use the terminal command setcap CAP_NET_ADMIN+ep /usr/sbin/traceroute to give traceroute the access it needs, but it's not working. The output is:

Failed to set capabilities on file `/usr/sbin/traceroute' (Invalid argument)
The value of the capability argument is not permitted for a file. Or the file 
is not a regular (non-symlink) file

How can I give sudo permission to an app?

  • 2
    setcap CAP_NET_ADMIN+ep "$(readlink -f /usr/sbin/traceroute)"
    – jordanm
    Commented Jun 21, 2016 at 2:52
  • 1
    Thanks that worked great!, also in addition toCAP_NET_ADMIN I needed CAP_NET_RAW and ran the permission against tcptraceroute in the sbin folder.
    – Crizly
    Commented Jun 21, 2016 at 13:02


You must log in to answer this question.

Browse other questions tagged .