报错的原因是选择的文件不是一个有效的 RSA 密钥文件
现在通过 ssh-keygen 默认生成的密钥文件是新的格式,并非 RSA 格式。打开文件可以看到是以 -----BEGIN OPENSSH PRIVATE KEY----- 开头的,模块无法识别。

解决方法

生成时指定格式:
通过 ssh-keygen -m PEM -t rsa 命令生成 RSA 格式的密钥对

ssh-keygen 参数

-m:参数指定密钥的格式,PEM(也就是 RSA 格式)是之前使用的旧格式

-b:指定密钥长度

-e:读取openssh的私钥或者公钥文件

-C:添加注释

-f:指定用来保存密钥的文件名

-i:读取未加密的ssh-v2兼容的私钥/公钥文件,然后在标准输出设备上显示openssh兼容的私钥/公钥

-l:显示公钥文件的指纹数据

-N:提供一个新密语

-P:提供(旧)密语

-q:静默模式

-t:指定要创建的密钥类型

Python paramiko 报错 paramiko.ssh_exception.SSHException: not a valid RSA private key file的更多相关文章

  1. mac 上python编译报错No module named MySQLdb

    mac 上python编译报错No module named MySQLdb You installed python You did brew install mysql You did expor ...

  2. 调用python脚本报错/usr/bin/env: python : No such file or directory

    一.调用python脚本报错 /usr/bin/env: python: No such file or directory 二.解决方法 原因是在windows上编写的脚本,使用dos2unix对脚 ...

  3. 第一次打开pycharm运行python文件报错”No Python interpreter selected“问题的解决办法

    前面没有细讲,这里细述一下安装pycharm后,第一次打开pycharm运行python文件报错"No Python interpreter selected"问题的解决办法. 出 ...

  4. CentOS中输入yum报错:sudo: unable to execute /bin/yum: No such file or directory

    今天尝试更新了下虚拟机CentOS中的python版本后. 运行“yum”命令,就报错:“sudo: unable to execute /bin/yum: No such file or direc ...

  5. mysql启动报错:Starting MySQL...The server quit without updating PID file

    在mysql的data目录下误删除了mysql-bin.000001,mysql-bin.000002等文件,但是没有删除mysql-bin.index文件,此时启动mysql就会报错: Starti ...

  6. EL表达式报错:  According to TLD or attribute directive in tag file, attribute value does not accept any expressions

    EL表达式报错: According to TLD or attribute directive in tag file, attribute value does not accept any ex ...

  7. 使用jstl报错:According to TLD or attribute directive in tag file, attribute value does not accept any expressions

    使用jstl报错:According to TLD or attribute directive in tag file, attribute value does not accept any ex ...

  8. 解决 php 报错 open_basedir restriction in effect或者nginx提示No input file specified怎么办

    解决 php 报错 open_basedir restriction in effect或者nginx提示No input file specified怎么办 问题是出现在了PHP.INI上面了 ,原 ...

  9. 使用jstl标签报错:According to TLD or attribute directive in tag file, attribute value

    原来jstl标签版本不一样,标签支持不一样. jstl1.0标签库不支持表达式,如: <c:if test="${query01 == null}">   <js ...

随机推荐

  1. oracle中utl_raw

    RAW,类似于CHAR,声明方式RAW(L),L为长度,以字节为单位,作为数据库列最大2000,作为变量最大32767字节.LONG RAW,类似于LONG,作为数据库列最大存储2G字节的数据,作为变 ...

  2. 《最优化导论第4版》高清中文版PDF+高清英文版PDF+习题题解

    <最优化导论第4版>高清中文版PDF+高清英文版PDF+习题题解 存放在语雀 凸优化 · 语雀

  3. umi+dva+antd新建项目(亲测可用)

    首先全局安装dva+umiumi:npm install -g umidva:npm install -g dva-cli 通过脚手架创建项目 一: mkdir myapp && cd ...

  4. 使用csv模块读写csv格式文件

    import csv class HandleCsv: ''' csv文件处理类 ''' def __init__(self, filename): ''' 构造器 :param filename: ...

  5. COMP2521: Assignment

    COMP2521: Assignment 2Social Network AnalysisA notice on the class web page will be posted after eac ...

  6. HTTP 状态码及含义

    来自 Koa.js 官方文档中关于设置请求响应的部分 response.status=,列出了从 1xx ~ 5xx HTTP 状态码及含义,现摘录如下: 100 "continue&quo ...

  7. Gallery -- 横向不断滚动 demo

    <%@ Page Language="C#" AutoEventWireup="true" %> <!DOCTYPE html> < ...

  8. git clone: HTTP Basic: Access denied 错误

    git clone 报 HTTP Basic: Access denied 错误 解决方案: 1. 如果账号密码有变动 用这个命令 git config –-system –-unset creden ...

  9. element-admin中echarts图标宽度无法修改

    默认示例 <template> <div> <el-row :gutter="0"> <el-col :xs="24" ...

  10. 一个匹配字字符串是aabbcc或者其他模式的运用

    <!--一个匹配字字符串是aabbcc或aaaabccc或者其他模式的运用--> function isPattern(str, pattern) { let str_a = str.sp ...