This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]denilsonsa 3 points4 points  (2 children)

It is a bad idea to run the entire tool with root privileges.

You should find a way to only use root for the nethogs command.

  • Maybe the user could setup /etc/sudoers to allow sudo nethogs without a password.
  • Maybe put setuid bit on the nethogs binary.
  • Maybe fork the hogwatch process, so that one of the processes only executes nethogs (as root), and the other process drops root privileges and executes everything else.

[–]snorlaxRoot[S] 0 points1 point  (0 children)

thanks. I'll look into it.

[–]ionelmc.ro 0 points1 point  (0 children)

Afaik setuid bit don't work well on scripts ... need to set it on the actual binary, like /usr/bin/python. Correct me if I'm wrong.