Unix questions - effective user id

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > November 2005 > effective user id





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author effective user id
Ajar

2005-11-23, 7:51 am

Hi,

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

TIA,
Ajar.

Gerry S.

2005-11-23, 5:54 pm

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

-G

Bill Marcum

2005-11-24, 2:48 am

On 23 Nov 2005 07:22:52 -0800, Gerry S.
<gerard.schlundt@gmail.com> wrote:
> Yes, unless the executeable has permissions set that would force it to
> act otherwise (the sticky bit)
>

I think you mean the setuid bit.

--
Diplomacy is the art of saying "nice doggy" until you can find a rock.
vvrajarao@gmail.com

2005-11-24, 8:49 pm

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 <sys/types.h>
#include <dirent.h>

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");
}

Gerry S.

2005-11-28, 6:04 pm

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 ;)

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com