Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

Java Exec (SU) + Reboot on Unix

Thread view: 
MMilkin@gmail.com - 16 Oct 2006 20:16 GMT
I have a fairly complicated process that I'm trying to develop in java
(and it has to be in java so switching to C where switching thread user
identity is easy and pain free is not an option)

The server runs on unix under a user with special permissions however
that user is not and cannot be root.  So my program needs to be able to
reboot the system if given a specific argument.

right now running rt.exec("reboot") will give me a permissions error

If I know the root password how can I procedurally reboot the system
with exec ?
Oliver Wong - 16 Oct 2006 22:17 GMT
>I have a fairly complicated process that I'm trying to develop in java
> (and it has to be in java so switching to C where switching thread user
[quoted text clipped - 8 lines]
> If I know the root password how can I procedurally reboot the system
> with exec ?

   Not sure what the security implications of this might be, but can't you
do a "sudo reboot", or something similar?

   - Oliver
steve - 17 Oct 2006 23:38 GMT
>> I have a fairly complicated process that I'm trying to develop in java
>> (and it has to be in java so switching to C where switching thread user
[quoted text clipped - 13 lines]
>
>     - Oliver

only root can.
After all you don't want little johnny  rebooting your system , just because
he happens to be a user on your system.

to be honest you should not be trying to do any "reboot" commands from java.

steve
steve - 16 Oct 2006 22:42 GMT
> I have a fairly complicated process that I'm trying to develop in java
> (and it has to be in java so switching to C where switching thread user
[quoted text clipped - 8 lines]
> If I know the root password how can I procedurally reboot the system
> with exec ?

you will need a script file.
pass in the password via a parameter ( same way  you pass params via linux)
then execute the script file from java, instead of running the commands
directly.

you will not be able to do it in separate calls.

or you could do it  via a telnet/SSH session from  your java app. !!

http://linuxmafia.com/ssh/java.html
Chris Uppal - 17 Oct 2006 11:08 GMT
> The server runs on unix under a user with special permissions however
> that user is not and cannot be root.  So my program needs to be able to
> reboot the system if given a specific argument.

I don't think putting the root password into the application -- or putting it
anywhere the application can read it -- is a very good idea.  In security terms
it is the equivalent of making the app run as root.

What I would do is create a SUID executable which (a) is only executable by the
application's special user, and (b) reboots the machine (and nothing else!).
It might even (c) do some extra checking to ensure that it is running as the
"right" user, and so on, before rebooting.

   -- chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.