Sudome
PoC for privileged projects from non-privileged PyCharm sessions.
Install / Use
/learn @samayer12/SudomeREADME
sudome
A proof-of-concept for PyCharm projects that must run with elevated permissions on Linux.
python-sudo.sh sources the virtual environment and then executes the project with elevated permissions.
setup.sh places the appropriate entry in /etc/sudoers.d/python.
The user must enter their sudo credentials during setup.sh.
Usage
-
Ensure
setup.shis executable (ls -l setup.sh).-rwxr--r-- 1 user user 535 Mmm DD HH:MM python-sudo.sh -
Run
./setup.shfrom project root. Example output:[user@host sudome]$ /bin/bash /home/user/PycharmProjects/sudome/setup.sh Configuration Line: [sudo] password for user: user host = (root) NOPASSWD: /usr/bin/python File contents: /etc/sudoers.d/python user host = (root) NOPASSWD: /usr/bin/python -
Add
pythonas a venv project interpreter in PyCharm. -
Add
python-sudo.shas a project interpreter in PyCharm. This will time out or throw an error, but it will be okay. -
Observe the available run configs from
.idea/runConfigurations/. -
Choose any config through PyCharm and run it (
Shift + F10).
Required Project Structure
ProjectRoot/
|-.idea/
| \- runConfigurations/
| \- [XML files]
|- src/
|- test/
|- python-sudo.sh
|- requirements.txt
\- setup.sh
Inspired by Eric Smith.
