1
2README of example directory
3====================================================================
4Last modified: Wed Oct 16 13:53:12 UTC 2002
5
6This directory contains some examples, which demonstrate how to use JSch
7
8- Shell.java
9  This program enables you to connect to sshd server and get the shell prompt.
10  $ CLASSPATH=.:../build javac Shell.java
11  $ CLASSPATH=.:../build java Shell
12  You will be asked username, hostname and passwd.
13  If everything works fine, you will get the shell prompt. Output will
14  be ugly because of lacks of terminal-emulation, but you can issue commands.
15
16- X11Forwarding.java
17  This program will demonstrate X11 forwarding.
18  $ CLASSPATH=.:../build javac X11Forwarding.java
19  $ CLASSPATH=.:../build java X11Forwarding
20  You will be asked username, hostname, displayname and passwd.
21  If your X server does not run at 127.0.0.1, please enter correct
22  displayname. If everything works fine, you will get the shell prompt.
23  Try X applications; for example, xlogo.
24
25- Exec.java
26  This program will demonstrate remote exec.
27  $ CLASSPATH=.:../build javac Exec.java
28  $ CLASSPATH=.:../build java Exec
29  You will be asked username, hostname, displayname, passwd and command.
30  If everything works fine, given command will be invoked
31  on the remote side and outputs will be printed out.
32
33
34- ViaHTTP.java
35  This program will demonstrate the ssh session via HTTP proxy.
36  $ CLASSPATH=.:../build javac ViaHTTP.java
37  $ CLASSPATH=.:../build java ViaHTTP
38  You will be asked username, hostname, proxy-server and passwd.
39  If everything works fine, you will get the shell prompt.
40
41- ViaSOCKS.java
42  This program will demonstrate the ssh session via SOCKS proxy.
43  $ CLASSPATH=.:../build javac ViaSOCKS.java
44  $ CLASSPATH=.:../build java ViaSOCKS
45  You will be asked username, hostname, proxy-server and passwd.
46  If everything works fine, you will get the shell prompt.
47
48- PortForwardingR.java
49  This program will demonstrate the port forwarding like option -R of
50  ssh command; the given port on the remote host will be forwarded to
51  the given host and port  on the local side.
52  $ CLASSPATH=.:../build javac PortForwardingR.java
53  $ CLASSPATH=.:../build java PortForwardingR
54  You will be asked username, hostname, port:host:hostport and passwd.
55  If everything works fine, you will get the shell prompt.
56  Try the port on remote host.
57
58- PortForwardingL.java
59  This program will demonstrate the port forwarding like option -L of
60  ssh command; the given port on the local host will be forwarded to
61  the given remote host and port on the remote side.
62  $ CLASSPATH=.:../build javac PortForwardingL.java
63  $ CLASSPATH=.:../build java PortForwardingL
64  You will be asked username, hostname, port:host:hostport and passwd.
65  If everything works fine, you will get the shell prompt.
66  Try the port on localhost.
67
68- StreamForwarding.java
69  This program will demonstrate the stream forwarding. The given Java
70  I/O streams will be forwared to the given remote host and port on
71  the remote side.  It is simmilar to the -L option of ssh command,
72  but you don't have to assign and open a local tcp port.
73  $ CLASSPATH=.:../build javac StreamForwarding.java
74  $ CLASSPATH=.:../build java StreamForwarding
75  You will be asked username, hostname, host:hostport and passwd.
76  If everything works fine, System.in and System.out streams will be
77  forwared to remote port and you can send messages from command line.
78
79- UserAuthPubKey.java
80  This program will demonstrate the user authentification by public key.
81  $ CLASSPATH=.:../build javac UserAuthPubKey.java
82  $ CLASSPATH=.:../build java UserAuthPubKey
83  You will be asked username, hostname, privatekey(id_dsa) and passphrase.
84  If everything works fine, you will get the shell prompt
85
86- Compression.java
87  This program will demonstrate the packet compression.
88  $ CLASSPATH=.:../build javac Compression.java
89  $ CLASSPATH=.:../build java Compression
90  You will be asked username, hostname and passwd.
91  If everything works fine, you will get the shell prompt.
92  In this program, all data from sshd server to jsch will be
93  compressed.
94
95- ScpTo.java
96  This program will demonstrate the file transfer from local to remote.
97  $ CLASSPATH=.:../build javac ScpTo.java
98  $ CLASSPATH=.:../build java ScpTo file1 user@remotehost:file2
99  You will be asked passwd.
100  If everything works fine, a local file 'file1' will copied to
101  'file2' on 'remotehost'.
102
103- ScpFrom.java
104  This program will demonstrate the file transfer from remote to local
105  $ CLASSPATH=.:../build javac ScpFrom.java
106  $ CLASSPATH=.:../build java ScpFrom user@remotehost:file1 file2
107  You will be asked passwd.
108  If everything works fine, a file 'file1' on 'remotehost' will copied to
109  local 'file1'.
110
111- Sftp.java
112  This program will demonstrate the sftp protocol support.
113  $ CLASSPATH=.:../build javac Sftp.java
114  $ CLASSPATH=.:../build java Sftp
115  You will be asked username, host and passwd.
116  If everything works fine, you will get a prompt 'sftp>'.
117  'help' command will show available command.
118  In current implementation, the destination path for 'get' and 'put'
119  commands must be a file, not a directory.
120
121- KnownHosts.java
122  This program will demonstrate the 'known_hosts' file handling.
123  $ CLASSPATH=.:../build javac KnownHosts.java
124  $ CLASSPATH=.:../build java KnownHosts
125  You will be asked username, hostname, a path for 'known_hosts' and passwd.
126  If everything works fine, you will get the shell prompt.
127  In current implementation, jsch only reads 'known_hosts' for checking
128  and does not modify it.
129
130- UserAuthKI.java
131  This program will demonstrate the keyboard-interactive authentication.
132  $ CLASSPATH=.:../build javac UserAuthKI.java
133  $ CLASSPATH=.:../build java UserAuthKI
134  If the remote sshd supports keyboard-interactive authentication,
135  you will be prompted.
136
137- KeyGen.java
138  This progam will demonstrate the DSA keypair generation.
139  $ CLASSPATH=.:../build javac KeyGen.java
140  $ CLASSPATH=.:../build java KeyGen rsa output_keyfile comment
141or
142  $ CLASSPATH=.:../build java KeyGen dsa output_keyfile comment
143  You will be asked a passphrase for output_keyfile.
144  If everything works fine, you will get the DSA or RSA keypair,
145  output_keyfile and output_keyfile+".pub".
146  The private key and public key are in the OpenSSH format.
147
148- ChangePassphrase.java
149  This program will demonstrate to change the passphrase for a
150  private key file instead of creating a new private key.
151  $ CLASSPATH=.:../build javac ChangePassphrase.java
152  $ CLASSPATH=.:../build java ChangePassphrase private-key
153  A passphrase will be prompted if the given private-key has been
154  encrypted.  After successfully loading the content of the
155  private-key, the new passphrase will be prompted and the given
156  private-key will be re-encrypted with that new passphrase.
157
158- AES.java
159  This program will demonstrate how to use "aes128-cbc".
160
161- Daemon.java
162  This program will demonstrate how to provide a network service like
163  inetd by using remote port-forwarding functionality.
164
165- Logger.java
166  This program will demonstrate how to enable logging mechanism and
167  get logging messages.
168
169- Subsystem.java
170  This program will demonstrate how to use the Subsystem channel.
171
172- Sudo.java
173  This program will demonstrate how to exec 'sudo' on the remote.
174
175- ScpToNoneCipher.java
176  This program will demonstrate how to enable none cipher.
177
178- JumpHosts.java
179  This program will demonstrate SSH through jump hosts.
180
181- OpenSSHConfig.java
182  This program will demonstrate how OpenSSH's config is supported.
183