Paramiko “Unknown Server”

前端 未结 5 2115
余生分开走
余生分开走 2020-11-22 15:13

I\'m trying to get started with the Paramiko library, but the library is throwing an exception as soon as I try to connect with the following simple program:



        
5条回答
  •  清酒与你
    2020-11-22 15:51

    I had this error: I can connect from the shell, but paramiko says "Unknown server workdevel114".

    There were two similar entries in known_hosts:

    user@host> grep workdevel114 ~/.ssh/known_hosts
    workdevel114 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC8qGbuI1BaBodi7sKWLfV8Eh+De80Th7HFLD4WiJWo57THl0Q+QcopUaU3pF....
    user@host> grep I1BaBodi7sKWLfV8Eh+De80Th7HFLD4WiJWo57THl0Q+QcopUaU3pF ~/.ssh/known_hosts
    workdevel114 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC8qGbuI1BaBodi7sK...
    |1|f/auQ9nY5dFbVtOdY3ocjtVO9dM=|esvazUDTT3VIcLk9DxmPI6FZt1s= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC8qGbuI1BaBodi7sKWLfV8Eh+De80Th7HFLD4...
    

    The seconds entry (|1|....) seems to confuse paramiko. I guess it is related to this ticket: https://github.com/paramiko/paramiko/issues/67

    I solved it by adding this line:

    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    

    But this disables host-checking of the ssh protocol in this case: Paramiko thinks the host key is unknown, but it is known. The known Key gets ignored. I don't care because man-in-the-middle attacks are very unlikely in my environment.

    paraiko-version: 1.7.7.1-1ubuntu1

提交回复
热议问题