用python的fabric的模塊
使用fab -p $passwd -H 192.168.9.23 – ‘ifconfig’
報錯如下:
[192.168.9.23] Executing task ‘host_type’
[192.168.9.23] run: ifconfig
No handlers could be found for logger “paramiko.transport”
[192.168.9.23] Login password for ‘root’:
Fatal error: Incompatible ssh peer (no acceptable kex algorithm)
Underlying exception:
Incompatible ssh peer (no acceptable kex algorithm)
Aborting.
修正問題:
翻閱網上一些方法,知對端ssh配置導致的,python 的fabric使用KexAlgorithms認證的算法,但是默認sshd配置了屏蔽了該算法,需要我們自己在對端服務器的sshd_config中添加該算法內容:
KexAlgorithms [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1