Access permissions

From: Spam Killer (nospam_at_spamtrap.com)
Date: 11/29/04


Date: Mon, 29 Nov 2004 13:40:41 GMT

How should I set the access permissions for a program that uses the
ports in Linux, like the one below? I build it with:

nasm -g -f elf cmos.asm
ld cmos.o -o cmos

Then I login as root and do:

chown root:root cmos
chmod +s cmos

But with "rm cmos" and answering "y" to "rm: remove write-protected
file `cmos´", I can delete it, when logged in as normal user. How can
I prevent this?

          global _start

          section .text align=16
_start: fninit
          sys Ioperm, 70h, 2, 3
          test eax,eax
          js error
          mov edi,msg
          xor bl,bl
nxt: mov al,bl
          out 70h,al
          in al,71h
          call byte2dec
          stosd
          inc bl
          jns nxt
          mov byte[temp],10
          sys Write, STDOUT, msg, 128*4+1

exit_ok: xor eax,eax
error: xor eax,-1
          lea ebx,[eax+1]
          sys Exit

          align 16
proc byte2dec
          movzx eax,al
          aam
          xchg ah,al
          shl eax,8
          xchg ah,al
          aam
          xchg ah,al
          or eax,20303030h
          ret
endp byte2dec

          section .bss align=16
msg resd 128
temp resb 1