LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-06-2005, 06:49 PM   #1
jpan
Member
 
Registered: Aug 2004
Distribution: Debian Libranet
Posts: 69

Rep: Reputation: 15
how to get root privilege in a script


Hi....i know that if you're a common user who want to become root,
you can use

$su -
then input the password.

But what if i want to run some commands which require root privileges
in a shell script and i'm just a common user?


it sounds like impossible since if Linux allow this it can be easily hurt by
hackers right?
 
Old 01-06-2005, 06:56 PM   #2
jpan
Member
 
Registered: Aug 2004
Distribution: Debian Libranet
Posts: 69

Original Poster
Rep: Reputation: 15
But what' i'm gonna do is i want to write a Java program, which will execute some
root-level system commands, and this program will be used by a common user. That means
my program has to provide the root password and switch the user to root during its
execution, right? so i wonder is there any ways to do it?

thanks!

Jimmy
 
Old 01-07-2005, 01:17 PM   #3
jpan
Member
 
Registered: Aug 2004
Distribution: Debian Libranet
Posts: 69

Original Poster
Rep: Reputation: 15
Provide Root password in a shell script

Don't miss my point....I'm the system administartor and knows the root password.
My question is how to provide the password in a shell script, since i can't do it
manually?


Jimmy
 
Old 01-07-2005, 01:39 PM   #4
drisay
Member
 
Registered: Sep 2004
Distribution: Slackware 10
Posts: 167

Rep: Reputation: 30
i'm no linux guru, so i have no clue if there is any other way, but you could use sudo. just a thought.
 
Old 01-07-2005, 01:50 PM   #5
jpan
Member
 
Registered: Aug 2004
Distribution: Debian Libranet
Posts: 69

Original Poster
Rep: Reputation: 15
hi, i found that there's no sudo command in my linux system. (I'm using Debian Libranet)
is there any other way? or you can tell me how to get sudo?
 
Old 01-07-2005, 02:46 PM   #6
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Freshmeat is your friend. It has lots of software projects; just about everything you could ever need and more. Just head to the site and search for "sudo". In fact, here's a link to the sudo page on freshmeat:
http://freshmeat.net/projects/sudo/

You can download it in whatever way the developers provide. It just so happens that sudo offers many different types of packages in case you're not comfortable installing things from source code.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute root-privilege programs in KDE autostart? rylan76 Linux - Software 3 07-31-2005 04:40 AM
Insufficient Privilege instead of Root Password Request buckberger Linux - Security 3 12-25-2004 08:00 PM
Temp root privilege in program? ZX_SA Programming 1 07-22-2004 08:14 AM
Why root has no privilege to access some directories ymei Linux - General 4 10-08-2003 08:14 AM
How to get root privilege in program using c? whepin Programming 1 04-06-2002 05:27 AM


All times are GMT -5. The time now is 11:41 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration