• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java and root access

 
alexandros mouzakidis
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i am working on a packaga manager for a new greek linux distro so i want my program to be run only by users that knows the root passward.Have you got any idea haw can i check the password;And how can i write a java program that runs with super user privilleges;
If i will not find the answers for this problems i have to write the program with c++ and i will have to studt about one weak libraries about making gui so any help i precious
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you intend the challenge the user for the root password?
 
alexandros mouzakidis
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am thinking about something like yast with an input box that will type the password and the validate this via encryption and check the shadow file
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sooo, you could receive the password, encrypt it the way your system does, and compare it to the shadow entry, yes? If they match, voila.

Your distro I am sure has a command-line utility to delegate the authorization check to.

As to code specifics, there's got to be a Java package out there that has already covered this. C++ doesn't give you anything here except perhaps a more well-known set of tools.
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would expect this to be a facility of the OS. You are going to need to use jni probably since most of linux is c. You can probalby open a shell within your program to execute commands from. it can be hidden from the user. You can change to super user in that shell and should be able to check from that shell if you have the super user as well.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't you ask the user to run the entire program as root, via (gk)sudo?

Then you may check by:

whether the user is root or not.
 
alexandros mouzakidis
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes this is probably the best solution tank you for your respond
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm. I'm not that sure...



...and made a test.

Can you enforce the programm to be installed by root (perhaps by social practise - not technically) and make it executable-by-root only?

(since jars aren't native executable - (mhmm - sometimes they are) the read-access is critical here, not execute-access.
btw: you're invited to the linux-forum.
 
alexandros mouzakidis
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not get any invitation mail but its ok i made an acount in www.linuxforum.com unless you ment something else.
We r gonna made an application like yast of suse, so the platforma is gonna run only by root and so the jar files r gonna be read only by root and users that have root access. Probably i should try check suse to see thay did it with yast. Thanks again for your respond!!
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well - I meant something else.

In the section 'Engineering' there is a subsection 'Linux/ Unix':

http://www.coderanch.com/forums/f-13/Linux-UNIX

Though it isn't meant for Java-on-Linux-questions only, you will find many topics related to both themes - in contrast to a linux-centric forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic