diff --git a/tmt/steps/provision/__init__.py b/tmt/steps/provision/__init__.py index f39fe19fbf..42b1653ddd 100644 --- a/tmt/steps/provision/__init__.py +++ b/tmt/steps/provision/__init__.py @@ -1278,6 +1278,13 @@ def _ssh_options(self) -> Command: options.extend(['-i', key]) if self.password: options.extend(['-oPasswordAuthentication=yes']) + else: + # Makes sure the connection is rejected when we want key- + # based authetication only instead of presenting a prompt + # Prevents issues like https://github.com/teemtee/tmt/issues/2687 + # from happening and makes the ssh connection more robust + # by allowing proper re-try mechanisms to kick-in + options.extend(['-oPasswordAuthentication=no']) # Use the shared master connection options.append(f'-S{self._ssh_socket()}')