effective user id - Unix

This is a discussion on effective user id - Unix ; Hi, when I do an exec, will the new progam inherit the effective user id of the calling process? TIA, Ajar....

+ Reply to Thread
Results 1 to 4 of 4

Thread: effective user id

  1. effective user id

    Hi,

    when I do an exec, will the new progam inherit the effective user id of
    the calling process?

    TIA,
    Ajar.


  2. Re: effective user id

    Yes, unless the executeable has permissions set that would force it to
    act otherwise (the sticky bit)

    -G


  3. Re: effective user id

    I have the code shown below. I have compiled it and changed the
    ownership of a.out to user2:user2 and set the setuid bit (chmod 04755
    a.out). Now I tried to run it as user1. The readdir system call
    function works fine, the directory contents of /home/user2 get printed.
    But, the 'system("ls -l /home/user2")', doesn't work, it gives the
    error "ls: /home/user2: Permission denied". Any ideas how to make this
    work? (btw, /home/user2 has the perms 700)

    --------------------------------------------------------------------------
    #include
    #include

    int main(){

    DIR *dirp = opendir("/home/user2");
    struct dirent* dp;
    while (dirp) {
    int errno = 0;
    if ((dp = readdir(dirp)) != 0) {
    printf("%s\n",dp->d_name);
    }
    else{break;}
    }
    system("ls -l /home/user2");
    }


  4. Re: effective user id

    Darn it! Yup -- sure do. Along with the setgid bit....I do that every
    darned time :\

    I'll blame my first mentor -- he taught me wrong


+ Reply to Thread