Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java Authentication

Status
Not open for further replies.

stu78

Programmer
May 29, 2002
121
GB
Hi,

I need to write a java applet which runs a unix script. However first in order to run the script I need to authenticate to a particular server with a users User Name & password.

How can I do this?

Basically - I need to log into a server with username & password, then kick off a script?

Thanks,
Stu
 
>>> I need to log into a server with username & password

How ? rlogin, telnet, ssh ...
Why can't the unix script do this section for you ?

>>> authenticate to a particular server
Using what method ?
 
Hi sedj,

I need to write a telnet client in Java I think. Do you know where I can get examples of how to do this?

Sorry - the original mail was unclear - however my requirements are clear now. Basically I need to run unix commands from a java applet, however i need also to be able to connect to the host etc. to do this....
 
There is a complete telnet applet (with source) at :


From which you should be able to use f.ex. "TelnetWrapper" like in the following piece of code :
(I have no access to a Unix host, so I haven't tried it yet. If needed I can maybe telnet to an AS/400)
Code:
import java.io.*;
import de.mud.telnet.*;

public class TelnetExample {

  public TelnetExample() {
  }

  public static void main(String args[]) {
    TelnetWrapper telnet = new TelnetWrapper();
    try {
      telnet.connect(args[0], 23);
      telnet.login("stu","***");
      telnet.setPrompt("/users/stu ->");
      telnet.waitfor("TERM =");
      telnet.send("dumb");
      System.out.println(telnet.send("ls -l"));
      } catch(IOException e) {
        e.printStackTrace();
      }
    }
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top