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

Whether mixed password authentication and public key authentication are supported #812

Open
Bamboo-devops opened this issue Sep 14, 2022 · 5 comments

Comments

@Bamboo-devops
Copy link

I have a project that requires both password and public key authentication, please tell me how to achieve it. Is there an example

@exceptionfactory
Copy link
Contributor

The SSHClient.auth() method supports the ability to provide multiple types of authentication methods, including password and public key authentication.

Apache NiFi has components that implement this approach. The StandardSSHClientProvider class builds a list of AuthMethod objects based on external configuration.

@hierynomus
Copy link
Owner

@Bamboo-devops This should indeed work by configuring multiple auth methods in the right order. SSHJ can then first do password authentication and if that partially succeeds additionally do the Pubkey authentication to fully authenticate the user.
If this answers your question, please close the issue.

@Bamboo-devops
Copy link
Author

got it.thanks all。

@jamespowenjr
Copy link

@hierynomus @exceptionfactory
Sorry to revive a dead thread, but it actually talks about something I was looking for almost exactly. We're actually using an FTP processor from Apache Nifi and ran into an issue with auth methods. Our issue is that the AuthMethods ordering seems to matter. That's not the case for most ssh clients and it's causing us trouble connecting to some FTP servers as some have different AuthenticationMethods configured in their sshd_config. They're similar, but the order can vary and we can't change them on the server side. Is it possible to make these checks order agnostic? For instance, if you use the openssh client's PreferredAuthentications options, it doesn't matter if you do "password,publickey" or "publickey,password".

@hierynomus
Copy link
Owner

Can you check whether #820 works for you?

@hierynomus hierynomus reopened this Sep 23, 2022
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

4 participants