File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes Connect to UNIX and execute commands from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Connect to UNIX and execute commands from Java" Watch "Connect to UNIX and execute commands from Java" New topic

Connect to UNIX and execute commands from Java

Pushpalatha Oleti

Joined: Jan 30, 2012
Posts: 1

I need to connect to unix and execute few commands to reset password of a user (on unix). I understand I cannot go with JSP to accomplish this and I have to use java code. In the link connect to unix , it is mentioned about enchanter jar. Could you please explain what enchanter jar is all about and how to connect to unix.

P.S: I am new to JavaRanch and Java, please excuse any mistakes.

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10825

Welcome to the Ranch.
If I understood your question correctly, you wish to execute some command on a remote unix machine, using java. I am not sure if this is even possible.
However, i will move your topic to a more appropriate forum, and hopefully someone might be able to help you out.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Badal Chowdhary
Ranch Hand

Joined: Apr 26, 2011
Posts: 34

Check out JSch if that helps:

Peter Johnson

Joined: May 14, 2008
Posts: 5852

You could also use exec() to run ssh and pass the passwd command to it.

JBoss In Action
I agree. Here's the link:
subject: Connect to UNIX and execute commands from Java
jQuery in Action, 3rd edition