ipython is launched like root (UID); ok, but I need that after ipython cann't run and don't allow, script/code that can gain root privilegies. eg
I launch ipython, ok the UID is root. And in my visudo file I change:
root ALL=NOEXEC:/usr/bin/sudo
user ALL=NOEXEC:/usr/bin/sudo
And take off both users of sudoers.
So... I run the next code:
import subprocess
from subprocess import Popen, PIPE
COMMAND = "sudo apt-get install g++ -y" #In this line, you put the code that you want to run
proccess = Popen(COMMAND, shell=True, executable="/bin/bash", stdout=PIPE, stderr=PIPE)
result = proccess.communicate()
o, e = result
print "*"*100
print "Output"
print "*"*100
for i in o.split("\n"):
print i
print "*"*100
print "Errors"
print "*"*100
for i in e.split("\n"):
print i
I need that ipython cann't do it this. I more, if I quit off sudo
from COMMAND; ipython allow me to do it!!!!
Please, help! Thanks!