Seems like the wrong way - the SSHDServer is a singleton and should be created 
only once (!). Please read the documentation on the MINA side about how to set 
up a server and how to configure command/shell factories.

________________________________
From: waseem.farooqui <waseem.farooqu...@gmail.com>
Sent: Thursday, March 2, 2017 12:53 PM
To: dev@mina.apache.org
Subject: Re: Apache MINA SSHd default ShellFactory Chocked the resources

How do you do that ?
I am connecting multiple client with the servers i-e I open 2 terminals and
ssh the server with both of them.
I open a new thread at every new connection like this

    public static void main(String[] args) {

        new Thread(new SshDaemon()).start();
    }

    @Override
    public void run() {

        SshServer sshd = SshServer.setUpDefaultServer();
        //creating the welcome banner for after login
        PropertyResolverUtils.updateProperty(
                sshd,
                ServerFactoryManager.WELCOME_BANNER,
                BANNER);

        sshd.setFileSystemFactory(new
VirtualFileSystemFactory(Paths.get(System.getProperty("user.dir"))));


        //adding the password authenticator
        sshd.setPasswordAuthenticator(
                new SshPasswordAuthenticator());

        //setting the port the ssh daemon is listening on
        sshd.setPort(PORT);
        sshd.setHost("0.0.0.0");
        //setting the class that hooks up users
        //with their session
//        sshd.setShellFactory( new SshSessionFactory() );



sshd.setSubsystemFactories(Collections.<NamedFactory&lt;Command>>singletonList(new
SftpSubsystemFactory()));
        sshd.setShellFactory(new ProcessShellFactory(new String[]{"/bin/sh",
"-i", "-l"}));


        sshd.setKeyPairProvider(
                new SimpleGeneratorHostKeyProvider(
                        new File("id_rsa")));

        try {
            sshd.start();
        } catch (IOException e) {
            e.printStackTrace();
        }

        //TODO replace with proper interrupt
        while (!shutdownRequested) {
            try {
                Thread.sleep(500);
            } catch (Exception e) {
            }
        }
    }

`sshd.setShellFactory(new ProcessShellFactory(new String[]{"/bin/sh", "-i",
"-l"}));` I am using this shell.
Its default and built-in I guess, will you please explain me with the code
How to use this `InteractiveProcessShellFactory`.



--
View this message in context: 
http://apache-mina.10907.n7.nabble.com/Apache-MINA-SSHd-default-ShellFactory-Chocked-the-resources-tp52309p52318.html
Apache MINA Developer Forum - Apache MINA SSHd default ShellFactory Chocked the 
resources<http://apache-mina.10907.n7.nabble.com/Apache-MINA-SSHd-default-ShellFactory-Chocked-the-resources-tp52309p52318.html>
apache-mina.10907.n7.nabble.com
Apache MINA SSHd default ShellFactory Chocked the resources. Hi Devs, I am 
using Apache MINA server for the ssh server implementation. I basically want to 
intercept all the commands typed by the...



Sent from the Apache MINA Developer Forum mailing list archive at Nabble.com.

Reply via email to