View topic - Getting root permissions

Getting root permissions

anything that doesn't fit to other groups.

Getting root permissions

Postby rnielsen » Tue Oct 08, 2002 11:15 pm

Hi, I am currently writing a little program that can partition and initialize a new hard drive from the console. The program is almost done but I need to log in as root to get permission to partition a HD.

I would like the program to be able to partition and format without logging in as root - I tried the function setuid() but that failed...... Any good ideas ?

Thanks
/Rene
rnielsen
New Member
 
Posts: 6
Joined: Tue Jul 23, 2002 4:14 pm

Postby noc » Wed Oct 09, 2002 4:07 pm

let's assume the executable filename of your application is "myapp":
su
chown root myapp
chmod u+s myapp
now you should be able to run "myapp" as a non-root user.
noc
Senior Member
 
Posts: 1634
Joined: Sat Jul 06, 2002 4:34 am


Return to General Programming

Who is online

Users browsing this forum: No registered users and 1 guest