For Linux and Shell scripting.

C Program to setuid to root user (run programs owned by other users)

Leave a comment

Sometimes you will need to permit normal users to run programs that are owned by other users (or root). Suppose, you have some important data under root’s ownership and you don’t want the users to read/modify them. But, users require them during their daily works. In such situation, you can make use of this program.

This program will call the shell script /root/scured/scripts/ which inturn will run under root’s ownership and should be able to access any files in the system. The users can access root owned files only through this program.

Along with userid (uid of the user who runs this program), this program will pass 9 commandline arguments to the shell script. If you want to pass more commandline arguemetns, you can add it. *

gcc setuid.c -o setuid-pgm *
chmod +s setuid-pgm *
mv setuid-pgm /usr/bin/

You can download the program from here.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s