*Hello, I have created a ssh server which is opening cmd. When i connect with
the ssh client cmd is open and for example if i write ls (which is the
command that i put in the code) everything is okay.

Now, my question is: How to create some command (for example: hello) and to
response some file.

Here is the code for my ssh server. I am using apache-mina library:*

public class SshServerMock{

public static void server() throws IOException, JSchException, SftpException
{
    SshServer sshd = SshServer.setUpDefaultServer();

    sshd.setHost("127.0.0.1");
    sshd.setPort(22);

    sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new
File("C://hostkey.ser")));
    sshd.setPasswordAuthenticator(new PasswordAuthenticator() {

        @Override
        public boolean authenticate(String u, String p, ServerSession s) {      
        
            return ("root".equals(u) && "pass".equals(p));
        }   

    });

    sshd.setShellFactory(new ProcessShellFactory(new String[] { "cmd.exe"
}));
    sshd.start();
    try {
        Thread.sleep(100000000000l);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }


}
}



--
Sent from: 
http://apache-mina.10907.n7.nabble.com/Apache-MINA-User-Forum-f31345.html

Reply via email to