ProgrammingThis 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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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).
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?
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.
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.