Skip to content
Advertisement

Tag: setuid

Using the setuid bit in Linux

I have this C file: I compile it, set the UID and GID both to root and set the setuid bit, so that it looks like this: However when I call $ ./a.out I still get: What am I doing wrong? Answer The real user ID is still the user that called the program, but the effective user ID is

setuid(0) fails to execute for root owned program

I need to write some code which can gain root priveleges and execute system level operations. Here’s what I’ve written (this is not the actual code, just to test if I’m doing things correctly or not): After doing gcc -o setuid setuid.c, I run ls -al on this to get following results: Trying to run the application results in: I

Advertisement