• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to connect to unix server

 
Ranch Hand
Posts: 68
MyEclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic