I think the easiest and safest way to do this is to make nethogs able to run without root permissions. You can do this by giving it the permissions it is currently temporarily acquiring as root every time you launch it. You can do that with the following command:
Once you have given nethogs these capabilities, it should be able to capture your network traffic without root permissions and you should therefore be able to use it with a shortcut, without having to fill out any credentials.
Edit /etc/sudoers
However, a more general way of solving this sort of problems can be found here How do I run specific sudo commands without a password? Which basically tells you how to safely add nethogs or any other command to /etc/sudoers to be able to execute it without manually having to type in a password.
There are two ways on how to solve this problem:
Grant
nethogs
the required capabilitiesI think the easiest and safest way to do this is to make
nethogs
able to run without root permissions. You can do this by giving it the permissions it is currently temporarily acquiring as root every time you launch it. You can do that with the following command:sudo setcap "cap_net_admin,cap_net_raw=ep" /usr/sbin/nethogs
Once you have given
nethogs
these capabilities, it should be able to capture your network traffic without root permissions and you should therefore be able to use it with a shortcut, without having to fill out any credentials.Edit
/etc/sudoers
However, a more general way of solving this sort of problems can be found here How do I run specific sudo commands without a password? Which basically tells you how to safely add
nethogs
or any other command to/etc/sudoers
to be able to execute it without manually having to type in a password.