libssh refuses to use specified ssh private key if "look_for_keys = False"
- Dominant language
- Cython
- Stars
- 79
- Forks
- 47
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 6
Description
##### SUMMARY
With the following configured, libssh always insists on using keyboard-interactive as authentication method.
INI:
[libssh_connection]
look_for_keys = False
Inventory Variable:
ansible_private_key_file: /path/to/correct/keyfile
##### ISSUE TYPE
- Bug Report
##### PYLISSH and LIBSSH VERSION
```paste below
$ python3 -c "import pylibsshext; print(pylibsshext.__version__)"
1.4.0
$ dpkg -l | grep libssh
ii libssh-4:amd64 0.10.6-2ubuntu0.5 amd64 tiny C SSH library (OpenSSL flavor)
ii libssh-gcrypt-4:amd64 0.10.6-2ubuntu0.5 amd64 tiny C SSH library (gcrypt flavor)
ii libssh2-1t64:amd64 1.11.0-4.1ubuntu0.24.04.4 amd64 SSH2 client-side library
```
##### OS / ENVIRONMENT
```bash
Ubuntu 24.04.5 LTS
```
##### STEPS TO REPRODUCE
1. Simple backup of Cisco Nexus switch config...
```bash
ansible-playbook plays/cisco-nexus.yml -l -v -t backup
```
```paste below
---
- hosts:
- platforms_cisco-nx-os
become: yes
gather_facts: no
collections:
- cisco.nxos
tasks:
- name: Save running-configuration
nxos_config:
save_when: modified
backup: yes
backup_options:
dir_path: "{{ running_config_backup_path }}"
filename: "{{ inventory_hostname }}-running-config.txt"
tags:
- backup
```
##### EXPECTED RESULTS
I expect it to connect with publickey
##### ACTUAL RESULTS
ansible.errors.AnsibleConnectionFailure: ssh connection failed: Failed to authenticate with keyboard-interactive: Received SSH_MSG_DISCONNECT: 2:Too many authentication failures
```paste below
ansible-playbook plays/cisco-nexus.yml -l -v -t backup
```
Contributor guide
Research direction
Run the provided ansible-playbook command with the [libssh_connection] setting and ansible_private_key_file inventory variable, then inspect the authentication behavior. Done means the specified private key is used with look_for_keys=False and the connection authenticates with publickey instead of keyboard-interactive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100