Link to home
Start Free TrialLog in
Avatar of pulupul
pulupul

asked on

Accessing operating system's user/password database from Java

I have to write a network server application which mantains a user/password list. I haven't started writing, I am still designing it, but I have thought of Java as, being a server, the more platforms it works on, the better, in addition to the rest of Java benefits. But the application needs to synchronize its user/password list with the the operating system user database. Windows 2000/XP/2003 Server user database synchronization is mandatory, and Windows NT 4 and Linux/Unix/*BSD is also important, but it could be sacrificed, depending on the difficulty, time needed/available and libraries available for it.
My questions are: How do I access the user database of the three operating system families I mentioned above from Java? is there a class or library that does this in a platform-independent way? if not, what are the best libraries for each OS family? or is there a way to do it with the Java API?.
As a last option, I could accept discarding multiplatform support and using C#, just in case .NET libraries have very good support for this, and Java a very bad one.

ASKER CERTIFIED SOLUTION
Avatar of Javatm
Javatm
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Otherwise there is no other way than to use other language like C++ or C#.

Hope that helps . . .
Javatm
Avatar of pulupul
pulupul

ASKER

I don't know if I explained myself correctly. I plan to use no database, unless required by some library. What I am asking is how to acces the internal OS user list, the one that in Windows XP/2000 you access by clicking Start->Run and typing lusrmgr.msc, and the one that in Linux is stored in /etc/passwd and /etc/passwd/shadow if using shadowed passwords.
Its an OS Specific part you can call a batch file from java or to run the lusrmgr.msc but for handling it, you have to use certain libraries which can
be done by other language and access it using JNI and use Java as an interface. Other solution would be using other language for direct access
to the OS like C++ or C# as what I said earlier.

Hope that helps . . .
Javat,
Avatar of pulupul

ASKER

Ok, thanks for the JNI info. I want to clarify that what I want is not to run lusrmgr.msc, but to programatically access the user database that lusrmgr.msc shows.
> I want to clarify that what I want is not to run lusrmgr.msc, but to programatically access the user database that lusrmgr.msc shows.

We can run and show lusrmgr.msc in java but to programatically access and use it is not possible unless you use JNI and other language
to programatically use it.
So which means to you have to invest your self through JNI and other native language or just use C++ and C#.
Avatar of pulupul

ASKER

What I need is a library that handles this.
>  What I need is a library that handles this.

If you have an open library in C or C++ which handles the neccessary task for it then call it JNI and use Java
as an interface to intract w/ it, this is the best way you can do it or else just use the .NET platform.
Avatar of pulupul

ASKER

Ok, if someone could tell me a library in Java or C/C++ (or C# as a last resort) that does the job, I will be satisfied.
You have to find a specific library maybe in C or C++ and handle it in JNI and make the calls from it to Java as the interface.
Avatar of pulupul

ASKER

Sure. From the guidelines:
"If you have given the Expert(s) ample time to respond to your clarification posts" - I have.
"and you have responded to each of their posts providing requested information" - I have.
"or if the answers, after clarification, lack finality or do not completely address the issue presented". This is the case. I was asking for a library or a method to access the OS's user/password list. What Javatm told me was a method to use libraries written in other languages, which is a different thing. In addition, I have the feeling that Javatm wasn't fully understanding what I was saying in my comments.

Anyway, I appreciate the answer. If you guys still think this is a B grader, I have no problem in giving it.
Avatar of pulupul

ASKER

I think the answer can be useful to someone who in the future asks the same question, and I don't need a refund.
But if you want me to give a B grade, I will give it happily.