Skip to content

fix #10909 unnecessary ssh password/passphrase prompts#141

Open
m-wrzr wants to merge 4 commits intotreeverse:mainfrom
m-wrzr:main
Open

fix #10909 unnecessary ssh password/passphrase prompts#141
m-wrzr wants to merge 4 commits intotreeverse:mainfrom
m-wrzr:main

Conversation

@m-wrzr
Copy link
Copy Markdown

@m-wrzr m-wrzr commented Dec 20, 2025

Hey, this PR addresses this issue in the main dvc repository treeverse/dvc#10909

The main issue was, that no matter what ssh configuration you set, the passphrase for the key is always prompted, even if you use ask_password and password based auth.

This is due to the InteractiveSSHClient still trying to use the publickey auth if we don't set the preferred_auth, i.e. we will always call public_key_auth_requested.

I've tried to replicate this behavior by expanding the docker based ssh tests, please let me know if you need some additional details/tests/etc

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Dec 20, 2025

CLA assistant check
All committers have signed the CLA.

@MothNik
Copy link
Copy Markdown

MothNik commented Feb 11, 2026

I can reproduce the issue and would highly appreciate if this fix would be merged.

Comment thread dvc_ssh/__init__.py Outdated
if port := config.get("port"):
login_info["port"] = port

# in case preferred_auth is empty, fallback is publickey
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we double check:

it probably means "do not constrain the method list", not fallback

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, I've tried to clarify the comment.

ask_password=True,
)

mock_getpass = mocker.patch(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be patched before we construct the file system above?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patching here is fine, since the f.fs call is initialising/making the actual connection



def test_password_set(ssh_server, mocker):
f = SSHFileSystem(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do we actually test here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's checking that we're not running into a password or ssh key password prompt, which would timeout the test. I've added a comment that makes this a bit clearer

this test fails with the current dvc-ssh version

Comment thread dvc_ssh/__init__.py Outdated
login_info[option] = config.get(option)

if login_info[option] or config.get(f"ask_{option}"):
login_info["preferred_auth"].append(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about keyboard-interactive method - let's check if we also need to pass it? and apply a fix like I was trying to do here https://github.com/treeverse/dvc-ssh/pull/143/changes

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not to familiar with keyboard-interactive auth tbh, it's already part of this PR? #144

Comment thread dvc_ssh/__init__.py Outdated

if login_info[option] or config.get(f"ask_{option}"):
login_info["preferred_auth"].append(
{
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion / minor: can we please refactor if a bit: move this dict as a var outside with some meaningful name, so otherwise it is written in way that it seems we append both each time tbh

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@m-wrzr m-wrzr requested a review from shcheklein May 2, 2026 08:48
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

Successfully merging this pull request may close these issues.

4 participants