Commit 83e39640 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2062] Print a message to stderr when not run as root

parent 99d2c13f
...@@ -79,5 +79,14 @@ def main(): ...@@ -79,5 +79,14 @@ def main():
print('~~~~~~~~~~~\n') print('~~~~~~~~~~~\n')
print(s.get_net_connections()) print(s.get_net_connections())
if os.getuid() != 0:
sys.stderr.write('NOTE: You have to run this program as the root user so that it can\n')
sys.stderr.write(' collect all the information it requires. Some information is\n')
sys.stderr.write(' only available to the root user.\n\n')
except Exception:
if __name__ == '__main__': if __name__ == '__main__':
main() main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment