How can a non-priv user find a NIC's speed?
Clearly ethtool is the way to go if you have privs, but what if you don't? I didn't see anything in /proc or /sys that jumped out at me, though that doesn't mean it isn't hiding in there somewhere.
-mark |
ethtool is USUALLY not a permissions issue in most distros but a path issue. Find or locate ethtool and use the full path to call it. In my case /sbin/ethtool
|
Quote:
Code:
which ethtool |
Quote:
[mjs@opteron167]$ /sbin/ethtool eth0 Settings for eth0: Cannot get device settings: Operation not permitted Cannot get wake-on-lan settings: Operation not permitted Current message level: 0x000000ff (255) Cannot get link status: Operation not permitted works just fine if I'm root -mark |
Quote:
|
Quote:
-mark |
Centos 5.1 and Fedora 8 straight out of the box. It has been the same on my installs at least since FC4. To the best of my knowledge I have not done anything special. What distro are you using?
|
Quote:
I'd think whatever runs on fedora would have made it into RHEL by now. Very odd... -mark |
Here’s the thing: on a vanilla kernel (2.6.19+) only a few ethtool operations are allowed for users without the CAP_NET_ADMIN privilege. Those operations are (taken from net/core/ethtool.c):
Code:
ETHTOOL_GDRVINFO: Get driver info Code:
ETHTOOL_GSET Get settings |
Makes sense to me. So that would then get me back to my original question of how can a non-privileged use tell what the interface speed is?
For what it's worth, and if anyone cares, the problem I'm trying to solve is when I monitor network traffic by looking at /proc/net/dev, and I think this is only on 64 bit systems, it very rarely reports bogus numbers and the only way to really tell they're bogus is that the traffic for that monitoring interval can be a large number. How large? It depends on the previous values of the counters. The most reliable way I can think of to tell a value is bad is if the reported traffic is more than double the speed of the interface and hence my need to know. -mark |
Quote:
I guess you have a few workarounds/choices, but all of them require elevated privileges eventually:
|
All times are GMT -5. The time now is 09:36 PM. |