LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-11-2009, 03:15 AM   #1
Asteroid
LQ Newbie
 
Registered: May 2007
Posts: 27

Rep: Reputation: 15
calling UNIX commands C/C++


hi Guys,

I am planning to write a program which can be able to execute scripts/commands which needs a user to be root.

Note: we are not interested to use sudoers option.

.e.g. The requirement can be explaind as:

Quote:
/opt/VRTS/bin/hastatus -sum
A normal UNIX system user cannot execute above command(veritas cluster summary command) root previleages are required for its executions. so facilitating normal users (who donot know root passwords) to execute above command we can adopt a program. The program knows root password and should internally execute the above command.
A sample program could be like below. I need to know how and where to provide root password.

Any suggestions.

Code:
#include"stdlib.h"
void main()
{

string root_passwd= "mypassword123";
system("/opt/VRTS/bin/hastatus -sum");

}
Thanks and Regards
@ asteroid
 
Old 03-11-2009, 04:49 AM   #2
abolishtheun
Member
 
Registered: Mar 2008
Posts: 183

Rep: Reputation: 31
having the root password as a string in the program is a ridiculous idea; is setuid what you're looking for?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
calling awk commands in perl script bharatbsharma Other *NIX 3 11-02-2007 07:07 PM
calling awk commands in perl script bharatbsharma Programming 6 11-02-2007 10:23 AM
Calling for Unix Articles unixnerd General 1 01-05-2006 09:42 AM
Calling all Linux/Unix users AMDPwred Linux - General 8 01-10-2002 08:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration