[Tutor] os.setuid(euid) function

Kirk Bailey idiot1@netzero.net
Mon Dec 2 02:50:02 2002


Then I have the pleasure of reporting a typo in the documentation.

Beyond that, when in my server, I ran python, and indeed os.getuid() works 
fine, and WHEN SUPERUSER setuid(990) (which is my non su id) worked fine.
But when I was NOT su, and did os.setuid(0), it said 'operation not 
permitted'. And this is EXACTLY what I want the thing to do- assume a 
priviliged identity to go change essencial files in the mail system.

The executable is python, and it is owned by root. If I turn on the 4000 bit 
it should execute as root ALWAYS, unless it has tricks of it's own to let it 
assume a nonpriviliged identity. This script has to interact with 
/etc/mail/aliases AS ROOT because no other identity can create this file.

Sure, there are people in the audience screaming, but the first thing I did 
was pay HEAVY attention to filtering the scripts input data. I'm more worried 
with the identity thing. Any advice?




Danny Yoo wrote:
> 
> On Mon, 2 Dec 2002, Kirk Bailey wrote:
> 
> 
>>Ok, in the os module, is the command 'seteuid(wuid)'. I tried this with 'root'
>>and as 0 (zero) as the arguement provided, and both ways it barks.
>>
>>Here is the error logged for each:
>>-----------------------------------------------------------------------------
>>Traceback (innermost last):
>>   File "/www/www.tinylist.org/cgi-bin/TLlistkill2.py", line 68, in ?
>>     os.seteuid('root')				# DIG, this is important. We are setting
> 
>           ^^^^^^^
> 
> Hi Kirk,
> 
> Check your spelling.  The code says "seteuid", but you meant to write
> 'setuid'.
> 
> 
> 
>>AttributeError: seteuid
> 
> 
> By "AttributeError", Python is complaining that it can't find the an
> "attribute", that it can't find a value that's named 'seteuid' within the
> 'os' module.
> 
> 
> Good luck!
> 
> 
> 


-- 

end

Respectfully,
              Kirk D Bailey


+---------------------"Thou Art Free." -Eris-----------------------+
| http://www.howlermonkey.net  mailto:highprimate@howlermonkey.net |
| KILL spam dead!      http://www.scambusters.org/stopspam/#Pledge |
| http://www.tinylist.org  +--------+   mailto:grumpy@tinylist.org |
+------------------Thinking| NORMAL |Thinking----------------------+
                            +--------+


---------------------------------------------
Introducing NetZero Long Distance
1st month Free!
Sign up today at: www.netzerolongdistance.com