problems with permissions?

Discussion in 'OT Technology' started by spoofy, Aug 12, 2004.

  1. spoofy

    spoofy Chemically Enhanced

    Joined:
    Aug 21, 2001
    Messages:
    5,014
    Likes Received:
    0
    Location:
    houston
    Ok.. long story short.. I need to write a program that runs setuid root. But.. for some reason.. even though my permissions are right.. and the code seems to be ok.. it doesnt work. My question is.. is there some security feature that prevents programs from running setuid in darwin?

    code:


    ruid = getuid();
    euid = geteuid();

    printf("ruid is %d euid is %d", ruid, euid);

    if((setuid(0)) != 0){
    fprintf(stderr, "setuid failed, errno = %d\n", errno);
    }

    if((seteuid(0)) != 0){
    fprintf(stderr, "seteuid failed, errno = %d\n", errno);
    }

    execve("/sbin/ifconfig", args, envp);

    }

    program output


    setuid failed, errno = 1
    seteuid failed, errno = 1
    ruid is 501 euid is 501


    program premissions:

    tranquility:~/code spoofyroot$ ls -asl ./bitch
    32 -rwsr-xr-x 1 root wheel 16088 12 Aug 16:06 ./bitch
     
  2. jabbadeznuts

    jabbadeznuts ΜΟΛΩΝ ΛΑΒΕ

    Joined:
    Jun 27, 2004
    Messages:
    3,143
    Likes Received:
    0
    Location:
    PDX
    the Root account is not enabled by default. Have you changed your settings so taht root IS enabled?
     
  3. spoofy

    spoofy Chemically Enhanced

    Joined:
    Aug 21, 2001
    Messages:
    5,014
    Likes Received:
    0
    Location:
    houston
    it doesnt have to be.. for example

    tranquility:~/code spoofyroot$ ls -asl /usr/bin/sudo
    192 -r-s--x--x 1 root wheel 96932 9 Jul 08:35 /usr/bin/sudo
     
  4. spoofy

    spoofy Chemically Enhanced

    Joined:
    Aug 21, 2001
    Messages:
    5,014
    Likes Received:
    0
    Location:
    houston
    problem fixed... aparently home directories are mouted nosuitd for security reasons... once i moved the binary to /usr/bin/ it works fine
     
  5. jabbadeznuts

    jabbadeznuts ΜΟΛΩΝ ΛΑΒΕ

    Joined:
    Jun 27, 2004
    Messages:
    3,143
    Likes Received:
    0
    Location:
    PDX
    Spoofy,

    just out of curiosity, how do you enable the root account?
     
  6. tsiawdspeed

    tsiawdspeed New Member

    Joined:
    Oct 4, 2003
    Messages:
    461
    Likes Received:
    0
    Location:
    Minnesota
    type in "su root" without quotes and then type in your password
     
  7. samm

    samm Next in Line

    Joined:
    Dec 22, 2000
    Messages:
    2,630
    Likes Received:
    0
    Location:
    San Jose, CA
    I think you can just do sudo bash (or your fav shell) to switch to root as well. I don't know if that requires the root account to be enabled though.
     
  8. dmora

    dmora Guest

    Enable root through the OS is doen in the net info utility in the utilities folder of the Apps folder.
     

Share This Page