This is an old revision of the document!
SSH known_hosts
Con una Debian 12 Bookworm o successive può capitare di avere delle righe in .ssh/known_hosts che vengono ritenute non più valide, il problema si presenta ad esempio quando si cerca di rimuovere una entry con il comando ssh-keygen -R:
ssh-keygen -f '/home/user/.ssh/known_hosts' -R '178.47.31.131' /home/user/.ssh/known_hosts:341: invalid line /home/user/.ssh/known_hosts:365: invalid line # Host 178.47.31.131 found: line 517 /home/user/.ssh/known_hosts:796: invalid line /home/user/.ssh/known_hosts is not a valid known_hosts file. Not replacing existing known_hosts file because of errors
Il risultato è che il comando -R fallisce e per rimuovere la riga non più desiderata (la 517 nell'esempio sopra) si dovrebbe editare manualmente il file known_hosts.
Nel nostro caso il problema è causato da righe che contengono chiavi di tipo ssh-dss:
<code> grep ssh-dss .ssh/known_hosts
| 1 | LGxo8EdPByFvfeW7VZEl7LrbNyY= |
| 1 | LcdQ2I9+yt+thkZh+R0dTZ22FH4= |
| 1 | z67A0kXdxyGJyyz4Y3ML6g330dA= |
</cod>
Il supporto alle chiavi ssh-dss è stato rimosso a runtime con OpenSSH 7.0 (agosto 2015), quindi rimosso in fase di compilazione con OpenSSH 9.8 (2024) e rimosso definitivamente con OpenSSH 10.0 (inizio 2025).
