SetUID don't work?? - Help

This is a discussion on SetUID don't work?? - Help ; Hi, I'm new to Linux. I'm trying to learn it myself through simple examples. For instance: If I create a script as root that does something that only root can do -- let's say one line: rmdir /root_only Let's say ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: SetUID don't work??

  1. SetUID don't work??

    Hi,

    I'm new to Linux. I'm trying to learn it myself through simple
    examples. For instance:

    If I create a script as root that does something that only root can do
    -- let's say one line:

    rmdir /root_only

    Let's say this file is called "deletethis".

    Now ...

    chmod u=rwxs,g=rwxs,o=rx deletethis

    Why is it when I run the script as someone else, it gives me a
    permission denied error. Isn't it supposed to run with root
    privileges? Maybe I don't understand how SetUID works?

    Dom.

  2. Re: SetUID don't work??

    On 2003-12-24, Domenic G. wrote:
    > chmod u=rwxs,g=rwxs,o=rx deletethis
    >
    > Why is it when I run the script as someone else, it gives me a
    > permission denied error. Isn't it supposed to run with root
    > privileges?


    Is it a script of some sort (sh, python, ...)? For security reasons Linux
    ignores the setuid bit on scripts. You need to write a little C (, C++,
    ....) instead.

    --
    Paul Kimoto
    This message was originally posted on Usenet in plain text. Any images,
    hyperlinks, or the like shown here have been added without my consent,
    and may be a violation of international copyright law.

  3. Re: SetUID don't work??

    Hi.

    domenicg@hotmail.com (Domenic G.) writes:

    > If I create a script as root that does something that only root can do
    > -- let's say one line:
    >
    > rmdir /root_only
    >
    > Let's say this file is called "deletethis".
    >
    > Now ...
    >
    > chmod u=rwxs,g=rwxs,o=rx deletethis
    >
    > Why is it when I run the script as someone else, it gives me a
    > permission denied error. Isn't it supposed to run with root
    > privileges? Maybe I don't understand how SetUID works?


    A shell script cannot be setuid. Read
    http://www.faqs.org/faqs/unix-faq/fa...section-7.html
    for an explanation of why setuid shell scripts can be a source of
    security holes.

    --
    Art Werschulz (8-{)} "Metaphors be with you." -- bumper sticker
    GCS/M (GAT): d? -p+ c++ l u+(-) e--- m* s n+ h f g+ w+ t++ r- y?
    Internet: agw@cs.columbia.eduWWW
    ATTnet: Columbia U. (212) 939-7060, Fordham U. (212) 636-6325

+ Reply to Thread