You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by rockyfm <na...@gmail.com> on 2015/12/17 01:51:46 UTC

Cannot start sshd 1.0 server

I am using Apache Mina sshd-core-1.0.0 to start an SFTP daemon. The program
however exits after the sshd.start(). There are no errors. However if I use
sshd-core-0.0.14, the server starts just fine and I can initiate an sftp
session. Am I missing something with 1.0.0 ?

Code snippet with 1.0.0 (does not work)
=========================
public static void main(String[] args) throws IOException {
    SshServer sshd = SshServer.setUpDefaultServer();
    sshd.setPort(2222);
    sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File
("hostkey.ser")))   
    sshd.setPasswordAuthenticator(new AuthenticatorImpl());
    sshd.start();
}

Code snippet with 0.0.14 (works)
=====================
public static void main(String[] args) throws IOException {
    SshServer sshd = SshServer.setUpDefaultServer();
    sshd.setPort(2222);
    sshd.setKeyPairProvider(new
SimpleGeneratorHostKeyProvider("hostkey.ser")); 
    sshd.setPasswordAuthenticator(new AuthenticatorImpl());
    sshd.start();
}




--
View this message in context: http://apache-mina.10907.n7.nabble.com/Cannot-start-sshd-1-0-server-tp49119.html
Sent from the Apache MINA User Forum mailing list archive at Nabble.com.

Re: Cannot start sshd 1.0 server

Posted by rockyfm <na...@gmail.com>.
Thanks Bill for the clarification.


> On Dec 17, 2015, at 1:15 AM, Bill Mair [via Apache MINA] <ml...@n7.nabble.com> wrote:
> 
> Probably the result of a fix somewhere between 0.0.14 and 1.0.0. 
> 
> At a guess, I would say that all the threads are now daemon threads, so 
> they won't stop a System.exit. This is what I would expect at least. 
> 
> You could try putting a "Thread.wait()" after sshd.start(), so that the 
> main thread doesn't exit and see if the rest still works as you want it. 
> 
> On 17/12/15 01:51, rockyfm wrote:
> 
> > I am using Apache Mina sshd-core-1.0.0 to start an SFTP daemon. The program 
> > however exits after the sshd.start(). There are no errors. However if I use 
> > sshd-core-0.0.14, the server starts just fine and I can initiate an sftp 
> > session. Am I missing something with 1.0.0 ? 
> > 
> > Code snippet with 1.0.0 (does not work) 
> > ========================= 
> > public static void main(String[] args) throws IOException { 
> >     SshServer sshd = SshServer.setUpDefaultServer(); 
> >     sshd.setPort(2222); 
> >     sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File 
> > ("hostkey.ser")))   
> >     sshd.setPasswordAuthenticator(new AuthenticatorImpl()); 
> >     sshd.start(); 
> > } 
> > 
> > Code snippet with 0.0.14 (works) 
> > ===================== 
> > public static void main(String[] args) throws IOException { 
> >     SshServer sshd = SshServer.setUpDefaultServer(); 
> >     sshd.setPort(2222); 
> >     sshd.setKeyPairProvider(new 
> > SimpleGeneratorHostKeyProvider("hostkey.ser")); 
> >     sshd.setPasswordAuthenticator(new AuthenticatorImpl()); 
> >     sshd.start(); 
> > } 
> > 
> > 
> > 
> > 
> > -- 
> > View this message in context: http://apache-mina.10907.n7.nabble.com/Cannot-start-sshd-1-0-server-tp49119.html <http://apache-mina.10907.n7.nabble.com/Cannot-start-sshd-1-0-server-tp49119.html>
> > Sent from the Apache MINA User Forum mailing list archive at Nabble.com <http://nabble.com/>.
> 
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://apache-mina.10907.n7.nabble.com/Cannot-start-sshd-1-0-server-tp49119p49123.html <http://apache-mina.10907.n7.nabble.com/Cannot-start-sshd-1-0-server-tp49119p49123.html>
> To start a new topic under Apache MINA User Forum, email ml-node+s10907n31345h13@n7.nabble.com <ma...@n7.nabble.com> 
> To unsubscribe from Apache MINA User Forum, click here <http://apache-mina.10907.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=31345&code=bmFpci5mbUBnbWFpbC5jb218MzEzNDV8NDgxMzc3MjY2>.
> NAML <http://apache-mina.10907.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://apache-mina.10907.n7.nabble.com/Cannot-start-sshd-1-0-server-tp49119p49133.html
Sent from the Apache MINA User Forum mailing list archive at Nabble.com.

Re: Cannot start sshd 1.0 server

Posted by Bill Mair <ap...@themairs.net>.
Probably the result of a fix somewhere between 0.0.14 and 1.0.0.

At a guess, I would say that all the threads are now daemon threads, so
they won't stop a System.exit. This is what I would expect at least.

You could try putting a "Thread.wait()" after sshd.start(), so that the
main thread doesn't exit and see if the rest still works as you want it.

On 17/12/15 01:51, rockyfm wrote:
> I am using Apache Mina sshd-core-1.0.0 to start an SFTP daemon. The program
> however exits after the sshd.start(). There are no errors. However if I use
> sshd-core-0.0.14, the server starts just fine and I can initiate an sftp
> session. Am I missing something with 1.0.0 ?
>
> Code snippet with 1.0.0 (does not work)
> =========================
> public static void main(String[] args) throws IOException {
>     SshServer sshd = SshServer.setUpDefaultServer();
>     sshd.setPort(2222);
>     sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File
> ("hostkey.ser")))   
>     sshd.setPasswordAuthenticator(new AuthenticatorImpl());
>     sshd.start();
> }
>
> Code snippet with 0.0.14 (works)
> =====================
> public static void main(String[] args) throws IOException {
>     SshServer sshd = SshServer.setUpDefaultServer();
>     sshd.setPort(2222);
>     sshd.setKeyPairProvider(new
> SimpleGeneratorHostKeyProvider("hostkey.ser")); 
>     sshd.setPasswordAuthenticator(new AuthenticatorImpl());
>     sshd.start();
> }
>
>
>
>
> --
> View this message in context: http://apache-mina.10907.n7.nabble.com/Cannot-start-sshd-1-0-server-tp49119.html
> Sent from the Apache MINA User Forum mailing list archive at Nabble.com.