/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<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-tp52309p52317.html
Sent from the Apache MINA Developer Forum mailing list archive at Nabble.com.