aspose file tools*
The moose likes Linux / UNIX and the fly likes How to connect to unix server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "How to connect to unix server" Watch "How to connect to unix server" New topic
Author

How to connect to unix server

Sumit Khurana
Ranch Hand

Joined: Sep 19, 2010
Posts: 68

Hi friends,

I need to connect to a unix server through telnet or SSH using java to automate an application and i don't know how to do this?
Please suggest me a way through which i can do this.

If you have any link of tutorial or any other information. Please share with me.

Thanks in anticipation.

With warm regards
Sumit Khurana
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

telnet is easy. Just open a network connection to the target machine's telnet port and start sending/receiving text lines. But telnet is also very insecure.

SSL is a bit harder and I've never tried it. Stuff like that is usually easier to handle by putting it into a native OS script and having Java execute the script.


Customer surveys are for companies who didn't pay proper attention to begin with.
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1110
    
  10

Most Linux/Unix systems I have worked with over the last few years do not enable Telnet since it has little or no security. The norm these days is to use SSH which creates an encrypted channel and SSH is available for just about all OS and is normally trivial to install. You will probably find it is already installed.

There are many Java SSH clients (Google will find them) but my preference is for JSch from http://www.jcraft.com/jsch/. Using it you can either execute a single command or pass multiple commands through a shell 'stdin'. Depending on your security requirements you can either use (username, password) authorization or public key certificate authorization; my preference is always for public key certificate authorization.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to connect to unix server