setuid program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pasear

    setuid program

    I find I can't run setuid perl script
    when I do this on a Unix-like platform:

    1.Create a file "setuid.pl" :
    #!/usr/bin/perl -T
    2.chmod a+x setuid.pl
    3.chmod u+s setuid.pl

    then i try

    shell> ./setuid.pl
    Permission denied.

    hmm...it always come out with this,
    and it's not because i don't have execute permission.
    The message was sent by perl,
    can anyone tell me how should I write a setuid program in perl?
    Without a external wrap on it.
    Thank you very much.
  • Dale Atkin

    #2
    Re: setuid program

    > The message was sent by perl,[color=blue]
    > can anyone tell me how should I write a setuid program in perl?[/color]

    Is it maybe that the perl interpreter is not running as root? What are the
    exact permissions on the perl script? I would imagine (but haven't verified)
    that if the current user has permission to execute the script, that it will
    load as that user, and not as root. Perhaps if the permissions are 700 on
    the perl script it might force the execution as root.

    Just a thought

    Dale


    Comment

    • pasear

      #3
      Re: setuid program

      Dale Atkin <newsposts@gree nsquare.ca> wrote:[color=blue][color=green]
      > > The message was sent by perl,
      > > can anyone tell me how should I write a setuid program in perl?[/color]
      > Is it maybe that the perl interpreter is not running as root? What are the
      > exact permissions on the perl script? I would imagine (but haven't verified)
      > that if the current user has permission to execute the script, that it will
      > load as that user, and not as root. Perhaps if the permissions are 700 on
      > the perl script it might force the execution as root.
      > Just a thought
      > Dale[/color]
      -rwsr-xr-x 1 wchunhao cp 19 Oct 8 00:04 setuid.pl*
      I want the program to be run by other people,
      and he can be setuid to my uid.
      I don't think the owner have to be root since I don't want it to setuid
      to root, just setuid to my uid.

      How to make it? thank u.

      Comment

      • Kris Wempa

        #4
        Re: setuid program


        "pasear" <wchunhao@csie. nctu.edu.tw> wrote in message
        news:bluom8$ii5 $2@netnews2.csi e.nctu.edu.tw.. .[color=blue]
        > I find I can't run setuid perl script
        > when I do this on a Unix-like platform:
        >
        > 1.Create a file "setuid.pl" :
        > #!/usr/bin/perl -T
        > 2.chmod a+x setuid.pl
        > 3.chmod u+s setuid.pl
        >
        > then i try
        >
        > shell> ./setuid.pl
        > Permission denied.
        >
        > hmm...it always come out with this,
        > and it's not because i don't have execute permission.
        > The message was sent by perl,
        > can anyone tell me how should I write a setuid program in perl?
        > Without a external wrap on it.
        > Thank you very much.[/color]

        Setuid scripts are very dangerous. I didn't think the operating system even
        honored the setuid bit for scripts. Am I mistaken ? Perl gave me loads of
        headaches even when I tried to convert the perl script to a binary file
        using perl2exe. Even after 'untainting' all of the variables, there were
        still many problems. I ended up having to re-write the program in C, which
        also happens to be the safest way to run a program as setuid.


        Comment

        Working...