anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: teemtee/tmt
Issue: tmt provision:  err: Received disconnect from 127.0.0.1 port 10035:2: Too many authentication failures

Main problem is that ssh-agent injects multiple identities before ssh even tries identity it was asked for. 

Fix is to use `-o IdentitiesOnly=yes` and optionally add `-o PasswordAuthentication=yes` if password will be used (just PasswordAuthentication=yes still allows ssh-agent to inject all identities first and connection is closed before password prompt happens)
Another way is to unset / set empty `SSH_AUTH_SOCK` variable so ssh-agent is not used.


Changed files:
tmt/steps/provision/__init__.py

diff --git a/tmt/steps/provision/__init__.py b/tmt/steps/provision/__init__.py
index 7477bd07..dfa682d5 100644
--- a/tmt/steps/provision/__init__.py
+++ b/tmt/steps/provision/__init__.py
@@ -220,11 +220,16 @@ class Guest(tmt.utils.Common):
             '-oStrictHostKeyChecking=no',
             '-oUserKnownHostsFile=/dev/null',
             ]
+        if self.key or self.password:
+            # Skip ssh-agent (it adds additional identities)
+            options.extend(['-oIdentitiesOnly=yes'])
         if self.port:
             options.extend(['-p', str(self.port)])
         if self.key:
             key = shlex.quote(self.key) if join else self.key
             options.extend(['-i', key])
+        if self.password:
+            options.extend(['-oPasswordAuthentication=yes'])
         return ' '.join(options) if join else options
 
     def _ssh_command(self, join=False):