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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-22-2004, 11:54 PM
|
#1
|
|
Member
Registered: Jul 2003
Location: NSW. Australia
Distribution: Ubuntu, Fedora, Slackware
Posts: 181
Rep:
|
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?
|
|
|
|
08-23-2004, 12:35 AM
|
#2
|
|
LQ Newbie
Registered: Aug 2004
Location: Sydney, Australia
Distribution: FreeBSD, Fedora Core 2
Posts: 20
Rep:
|
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).
|
|
|
|
08-23-2004, 06:12 AM
|
#3
|
|
Member
Registered: Jul 2003
Location: NSW. Australia
Distribution: Ubuntu, Fedora, Slackware
Posts: 181
Original Poster
Rep:
|
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!
|
|
|
|
08-23-2004, 08:13 AM
|
#4
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 15,261
|
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.
|
|
|
|
08-23-2004, 08:55 PM
|
#5
|
|
Member
Registered: Jul 2003
Location: NSW. Australia
Distribution: Ubuntu, Fedora, Slackware
Posts: 181
Original Poster
Rep:
|
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?
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:46 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|