Reputation: 1356
So, this is kind of confusing but essentially I'm using Django and I want to instantiate a subprocess to run a perl script. I've read that this can be done with
arg = "/some/file/path/"
pipe = subprocess.Popen(["./uireplace", arg], stdin=subprocess.PIPE)
which works when I call it in the appropriate function in views.py but the script requires a sudo. I then call this
pipe = subprocess.Popen(["sudo","./uireplace", arg], stdin=subprocess.PIPE)
which works when I run it in python from a terminal but this doesn't work when it's called by a random user on the web. Is there any way to be able to automatically enter in a username and password for that sudo? The issue is that this can't be done with a prompt so it simply fails.
Upvotes: 1
Views: 965
Reputation: 85432
Solves this problem on the OS level. Giving any user from the web the right to use sudo
does not sound right. Just make ./uireplace
executable. There are lots of options for chmod to fine tune this.
Upvotes: 2