PDA

View Full Version : Python with setuid



grial
8th August 2004, 09:42 PM
Hi, guys!

I need to write a programme for user managment which would run system commands like: useradd. I thought to write this in python script (through 'commands' module ), but it seems to ignore the setuid parameter, so the script can't get the authority to do it's job. Is that ( running setuid python scripts ) something which is disabled in fedora? If that is so, can anyone recomend me a good way to run unix commands in C++, I tried the fork, exec, pipe etc. method, is there anything simplier (some library ) supplied with fedora?

Thanks in advance!

circulus
8th August 2004, 09:49 PM
Hallo,

try set the setuid bit on /usr/bin/python - a Python interpreter. There must be any solve because the some (may be all ?) system-config-* scripts are written in Python.

circulus

crackers
9th August 2004, 04:01 AM
The "system-config-*" programs in /usr/bin are sym-linked to /usr/bin/consolehelper

My suggestion: man consolehelper and DO NOT SUID python! That is a monstrous security hole and will bite you in the posterior more often than not. Playing with the suid bit is extremely dangerous, in any case.