📄 j2ssh-clientserver-part-two.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<h2><font face="Verdana, Arial, Helvetica, sans-serif">Part Two - Building an SSH server to
provide your applications services. </font>
<font face="Verdana, Arial, Helvetica, sans-serif">
</font></h2>
<font face="Verdana, Arial, Helvetica, sans-serif">
<p><font size="2">In the previous part of this article I showed you how to secure
your client-application server by using J2SSH to create an embeded tunnel to
an SSH server installed on the same host as your server. Whilst the tunnel is
secure it does not provide access to the strong public key authentication that
SSH provides. In this article we take no prisoners, were going to implement
an SSH server and transfer your existing application server functionality into
the SSH server itself so that your application can take advantage of public
key authentication and other SSH services such as SFTP. </font></p>
<p><font size="2"><em><strong>Starting the basic framework server</strong></em><br>
</font><font size="2">First things first, even before you think about how to get your
existing application functionality into the SSH server, you need to get the
server itself running and accepting each connection and authenticating the user.
Make sure you have the source version of J2SSH since we're going copy the <code>com.sshtools.daemon.SshDaemon</code> source code to create your server. </font></p>
<p><font size="2">If you examine this class you will see that
it has a main method and so we're going to use this class to configure, start
and stop your server.Lets not worry about what the SshDaemon is doing right now,
lets just make sure we can start and stop the server. You may have noticed that
the main method allows a couple of command line arguments -start and -stop.
No guessing for what these do! Before we start the server there are a couple
of configuration items we need to attend to. First of all the server needs a
public key to identify itself to clients. </font><font size="2">Generate a key pair using the J2SSH
command line utility ssh-keygen.</font></p>
<p><code>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -