Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 03-11-2009, 04:15 AM   #1
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:

/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.

void main()

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

Thanks and Regards
@ asteroid
Old 03-11-2009, 05:49 AM   #2
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?


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 08:07 PM
calling awk commands in perl script bharatbsharma Programming 6 11-02-2007 11:23 AM
Calling for Unix Articles unixnerd General 1 01-05-2006 10:42 AM
Calling all Linux/Unix users AMDPwred Linux - General 8 01-10-2002 09:58 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:01 AM.

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