Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InteractiveProcessShellFactory . Each character entered is repeated #469

Open
whyDK37 opened this issue Feb 23, 2024 · 2 comments
Open

InteractiveProcessShellFactory . Each character entered is repeated #469

whyDK37 opened this issue Feb 23, 2024 · 2 comments

Comments

@whyDK37
Copy link

whyDK37 commented Feb 23, 2024

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

@lgoldstein
Copy link
Contributor

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.

@whyDK37
Copy link
Author

whyDK37 commented Feb 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants