mina-sshd icon indicating copy to clipboard operation
mina-sshd copied to clipboard

InteractiveProcessShellFactory . Each character entered is repeated

Open whyDK37 opened this issue 1 year ago • 2 comments

Version

2.12.1

Bug description

Start a service with sshd, connect to the service with iterm, and repeat each time you enter the command, including carriage return

Actual behavior

Using follow code to start one server .

        SshServer sshd = ServerBuilder.builder()
                .build();

        sshd.setShellFactory(InteractiveProcessShellFactory.INSTANCE);

        SimpleGeneratorHostKeyProvider keyPairProvider = new SimpleGeneratorHostKeyProvider(Paths.get("/tmp/key"));
        keyPairProvider.setOverwriteAllowed(false);
        sshd.setKeyPairProvider(keyPairProvider);

        sshd.setPasswordAuthenticator(AcceptAllPasswordAuthenticator.INSTANCE);
        sshd.setFileSystemFactory(new NativeFileSystemFactory());
        sshd.setCommandFactory(ProcessShellCommandFactory.INSTANCE);
        sshd.setPort(22);
        sshd.start();
        System.out.println("sshd.isStarted() = " + sshd.isStarted());
        TimeUnit.DAYS.sleep(1);
        sshd.stop();

Console log :

15:58:02.758 [main] INFO  org.apache.sshd.common.io.DefaultIoServiceFactoryFactory [getIoServiceProvider:68] - No detected/configured IoServiceFactoryFactory using Nio2ServiceFactoryFactory
sshd.isStarted() = true

Then use Iterm to connect to ssh server. image

Expected behavior

Expect to use commands like a normal shell after connecting to the sshd service

Relevant log output

No response

Other information

Thanks a lot

whyDK37 avatar Feb 23 '24 08:02 whyDK37

This is actually an (oldie...) duplicate of SSHD-897. Basically, we are aware of this problem but do not currently think it has enough of a priority to invest our (very limited) R&D resources. As explained in the referenced issue this needs specialized integration with external libraries (e.g., jline-terminal-jans). You are more than welcome to create such a PR and submit it for merge - if you do undertake this venture, I recommend adding it under the sshd-contrib module since we keep our core dependencies as "clean" as possible.

lgoldstein avatar Feb 27 '24 16:02 lgoldstein

Thanks for your reply. I checked the issue and it has been there for a long time. I'm just getting started with sshd and I'm going to try to figure out how to fix this.

whyDK37 avatar Feb 28 '24 01:02 whyDK37