File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes I want to login ( using Telnet ) to a Unix server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

I want to login ( using Telnet ) to a Unix server

sharjeel afzal
Greenhorn

Joined: Sep 30, 2009
Posts: 22
Hi,

I wanted to write a Java Program which will login ( using Telnet ) to a
Unix Server ( Ex: Solaris, Red Hat Linux) and issue some commands in
the Solaris.

The Java Program should be written in Windows machine.
If the java program is executed, then commands like ps -ef should be
executed in the unix server.
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

Since it is insecure, most servers will not have a Telnet server running. You need to check with the target server's admin before attempting this since they get kind of upset if you seem to be trying to break into their server.

You might have more luck with SSH and for that you can use a number of libraries. My preferred SSH library is JSSH from JCraft - http://www.jcraft.com/jsch/. You can get both Telnet and SSH libraries from http://javassh.org/space/start but I have very limited experience of these products. There is also a telnet client as part of "Jakarta Commons Net"; here Google is your friend.

Again, check with the server admin before trying to connect.


Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
sharjeel afzal
Greenhorn

Joined: Sep 30, 2009
Posts: 22
i write the follwing code but it just open intractive window for telnet



i want to create a telnet session from java program so that i execute commands on it like ps -ef etc
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

Once again my posts are invisible!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

Sharjeel, UseOneThreadPerQuestion. You've already been given advice here yesterday. Right now you've wasted some of James' time; the Apache telnet client had already been mentioned (but the links are still good).

I'm closing this thread.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I want to login ( using Telnet ) to a Unix server