LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 08-22-2004, 11:54 PM   #1
ludeKing
Member
 
Registered: Jul 2003
Location: NSW. Australia
Distribution: Ubuntu, Fedora, Slackware
Posts: 181

Rep: Reputation: 30
prompt for root password and passing to a program


Hi all,
I am creating a script that will automatically install some source code and hence, requires the root password to be used. This program will be written in Java. Basically I need to program to be able to accept the root password as a variable then use it when the 'make install' stage comes around.

Alternatively, I would like to become the superuser automatically, ie switch to root PID.

The other uglier way to run this is that you must be root so the password is not needed. Hmm.

Any help on this?
 
Old 08-23-2004, 12:35 AM   #2
DanTheKiwi
LQ Newbie
 
Registered: Aug 2004
Location: Sydney, Australia
Distribution: FreeBSD, Fedora Core 2
Posts: 20

Rep: Reputation: 0
why not just run 'su -' from your program? If your program is graphical I'm sure there are some X varients of SU (like the one used in gnome for instance).
 
Old 08-23-2004, 06:12 AM   #3
ludeKing
Member
 
Registered: Jul 2003
Location: NSW. Australia
Distribution: Ubuntu, Fedora, Slackware
Posts: 181

Original Poster
Rep: Reputation: 30
Yeah it is graphical. I'll keep looking, might have to have the prog check if the user that runs the prog is PID 0.... how could I do this in Java. I know how to in Perl!

Also, do you think it would be easier to have a Perl script as the guts of the installing etc and Java as the GUI. Although anyone could mess with the perl script. Unless I md5sum it and md5sum check it each time the GUI calls it?

Hmm, so many ideas!
 
Old 08-23-2004, 08:13 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
Another option, if install is a regular occurence, is to create a user that only does installs (and similar) and then set the account up to use the sudo tool.
 
Old 08-23-2004, 08:55 PM   #5
ludeKing
Member
 
Registered: Jul 2003
Location: NSW. Australia
Distribution: Ubuntu, Fedora, Slackware
Posts: 181

Original Poster
Rep: Reputation: 30
Don't know if that is a possibility. What i am making is a program that hopefully will be good enough to be included with a distro, that handles compileing and installing source code and packages, as a GUI, like Windows Installshield.....
might just have to ensure its run as root (PID 0).

how could I do this in Java?
 
  


Reply



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
Run a .desktop as root without password prompt subquantum Mandriva 3 07-31-2005 11:38 PM
My Knoppix 3.7 need root password when I run program AskMe Linux - Software 5 04-15-2005 05:35 AM
run program as root / password prompt acidjuice Linux - Software 6 03-15-2005 10:33 PM
Root Password Prompt Greyed Out !!! lionking_x Linux - Software 2 04-08-2004 10:05 AM
no password prompt after root login taboo Linux - General 1 12-22-2003 01:01 PM

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

All times are GMT -5. The time now is 02:32 AM.

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
Open Source Consulting | Domain Registration