views:

33

answers:

1

Hello, I have to admin kerberos users directly in Java (J2EE web-app). How can I do the equivalent to kpasswd (or kadmin) command with/without extra lib? I found a few commercial APIs but they are very expensive...

Thank you for your help

A: 

Can you just invoke kpasswd from your application?

String cmd = "kpasswd -principal foo -passwd bar";
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(cmd);
pr.waitFor();
BufferedReader r = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = "";
while ((line=r.readLine()) != null) {
  // TODO process response
}
r.close();
locka
locka
Thank you for your answer. I'll chose your solution when I am sure there is no other way, since invoking "kpasswd" from my app leads to a tricky process like"invoke kpasswd principal" then "enter old passwd" then "enter new passwd" then "confirm new passwd" which is not very nice in Java
BigMac
The other problem is the fact that a user must be able to change the passwd of an other user, like an admin. However, the "kpasswd" command asks for the old user's passwd, unknown by the admin!
BigMac