一起学习
启动演示 SSH Shell Server
引用
D:workspaceSecureJSH>ant demo
Buildfile: build.xml
build:
compile-demo:
run-java-demo:
[java] SSH-2.0-SJSHD-1.0: Generating an authorized key for user sjsh...
[java] SSH-2.0-SJSHD-1.0: New authorized private key for user sjsh stored to D:workspaceSecureJSHSJSH-Demo-Roothomesjsh.sshid_rsa
[java] SSH-2.0-SJSHD-1.0: Updated authorized public keys for user sjsh stored to D:workspaceSecureJSHSJSH-Demo-Roothomesjsh.sshauthorized_keys
[java] SSH-2.0-SJSHD-1.0(@localhost/127.0.0.1:22022): Starting...
[java] SSH-2.0-SJSHD-1.0: Generating Host DSA Key...
[java] SSH-2.0-SJSHD-1.0: Host DSA Key Stored to: D:workspaceSecureJSHSJSH-Demo-Rootetcsshssh_host_dsa_key
[java] SSH-2.0-SJSHD-1.0: Host DSA Public Key Stored to: D:workspaceSecureJSHSJSH-Demo-Rootetcsshssh_host_dsa_key.pub
[java] SSH-2.0-SJSHD-1.0: Generating Host RSA Key...
[java] SSH-2.0-SJSHD-1.0: Host RSA Key Stored to: D:workspaceSecureJSHSJSH-Demo-Rootetcsshssh_host_rsa_key
[java] SSH-2.0-SJSHD-1.0: Host RSA Public Key Stored to: D:workspaceSecureJSHSJSH-Demo-Rootetcsshssh_host_rsa_key.pub
[java] SSH-2.0-SJSHD-1.0(@localhost/127.0.0.1:22022): Started.
[java] Now you can login using an SSH client, with:
[java] User Name: sjsh
[java] Private Key: D:workspaceSecureJSHSJSH-Demo-Roothomesjsh.sshid_rsa
[java]
[java] Type in anything to stop:
然后通过任意SSH客户端连接上去:
(注意OpenSSH客户端需要更改 SJSH-Roothomesjsh.sshid_rsa 的权限属性为 600, 其他客户端不支持PEM格式私钥的需要转换其格式, PuTTY 带的 PUTTYGEN 工具转换比较好用)
引用
Using username "sjsh".
Authenticating with public key "imported-openssh-key"
This is an interactive Java(TM) shell, type in Java(TM)
statements to get them executed.
Type in Ctrl^D to logout.
Type in ? or help for a list of available commands.
Type in to complete commands.
Use UP/DOWN arrow keys for command history.
Here you are in the demo shell.
There are two demo built-in commands: msg and msgs,
and one built-in field: msgs, those are added by this demo.
Try them out and write your own shell similarly.
SecueJSH Java(TM) Compiler Ready.
[jsh ]$ ?
Built-in commands:
class
Start defining a new class in current package
def [ [
下载本文示例代码
SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理SSH的交互式Java应用开发和管理
阅读(278) | 评论(0) | 转发(0) |