Posts

Showing posts with the label sudo

How to run root python scripts on Pycharm

Image
Mininet needs root privileges ti run. If you run a python mininet script on Pycharm you will see the following message: *** Mininet must run as root. To enable root privileges, you need create a new interpreter as follows: sudo visudo -f /etc/sudoers.d/python Add the following information: <user> <host> = (root) NOPASSWD: <full path to python> For example: boettcher boettcher-server = (root) NOPASSWD: /usr/bin/python Create a script called python-sudo.sh, containing (with your correct full python path): #!/bin/bash sudo /usr/bin/python "$@" Be sure to make the script executable: chmod +x python-sudo.sh To change your actual interpreter for this new one, in PyCharm, go to File > Settings > Project Interpreter. Click the gear icon by the current Project Interpreter drop-down, and choose “More…”. Then click the green plus icon to add a new interpreter (Add Local). Browse to python-sudo.sh and select it  and ...