You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Netmiko执行NXOS设备SCP拷贝时ReadTimeout问题排查求助

Netmiko操作NXOS设备SCP拷贝时,已完成拷贝但触发ReadTimeout异常

脚本代码

core1 = {"device_type":"cisco_nxos","host":"192.168.254.51","username":"admin","password":"admin"}
net_connect = ConnectHandler(**core1)
net_connect.enable()
cmds = [["copy start scp://admin:admin@192.168.254.55/my-backup.cfg vrf management",r"Password"],["admin",""]]
r = net_connect.send_multiline(cmds)
net_connect.disconnect()

异常信息

脚本实际已完成配置拷贝,但超时后抛出如下异常:

netmiko.exceptions.ReadTimeout: 

Pattern not detected: 'admin' in output.

会话日志

推测因密码输入为隐藏状态,Netmiko无法捕获输入,会话日志如下:

Prod-CORE1# 
Prod-CORE1# terminal width 511
Prod-CORE1# terminal length 0

Prod-CORE1# 
Prod-CORE1# 
Prod-CORE1# 
Prod-CORE1# copy start scp://********:********@192.168.254.55/my-backup.cfg vrf management
Outbound-ReKey for 192.168.254.55:22
Inbound-ReKey for 192.168.254.55:22
User Access Verification

Password: 

Prod-CORE1-startup-config                                                                                                                                                                                                                                                                                                                                                                                                                                                                      0%    0     0.0KB/s   --:-- ETA
Prod-CORE1-startup-config                                                                                                                                                                                                                                                                                                                                                                                                                                                                    100% 5153   544.0KB/s   00:00    
Copy complete, now saving to disk (please wait)...
Copy complete.

Prod-CORE1# 
Prod-CORE1# exit

需求

寻求处理Netmiko隐藏输入或发送盲命令的方法,另外NXOS的SCP拷贝会忽略URL中的账号密码格式,仍需手动输入密码。

内容的提问来源于stack exchange,提问作者ccie50268

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 09:10:35