Permissions 0755 for ‘/etc/ssh/ssh_host_rsa_key‘ are too open.问题解决

1、问题背景

代码上库公司git后,将项目上出的程序烧录到设备中,wifi能够正常链接,但是通过wifi链接 ssh登录设备失败。把调试串口引出,查看linux启动log,发现如下打印信息:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@ WARNING: UNPROTECTED PRIVATE KEY FILE! @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Permissions 0755 for '/etc/ssh/ssh_host_rsa_key' are too open.

It is required that your private key files are NOT accessible by others.

This private key will be ignored.

key_load_private: bad permissions

Could not load host key: /etc/ssh/ssh_host_rsa_key

...

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@ WARNING: UNPROTECTED PRIVATE KEY FILE! @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Permissions 0755 for '/etc/ssh/ssh_host_ed25519_key' are too open.

It is required that your private key files are NOT accessible by others.

This private key will be ignored.

key_load_private: bad permissions

根据提示内容Permissions 0755 for '/etc/ssh/ssh_host_rsa_key' are too open(文件权限给的太宽泛了).

查看文件的属性:

上面所有文件的owner为root,而正常设备对应的文件owner为admin.

是谁修改了其属性?和devops工程师沟通,其在从公司git上拉代码时使用了root权限,导致下载到其编译服务器上的文件owner全部是root,最终编译rootfs时打包出来的上述文件owner为root.

2、如何解决

使用chown将上述文件的owner修改admin:chown admin ssh_host* .

重新启动sshd:sshd -D&

链接设备wifi,ssh能够正常登录设备进行远程访问。

相关推荐
小丑西瓜6661 分钟前
CMake基础用法,cmake_minimum_required,project,add_executable
linux·服务器·c++·camke
晚风吹长发6 分钟前
初步了解Linux中的命名管道及简单应用和简单日志
linux·运维·服务器·开发语言·数据结构·c++·算法
大熊背35 分钟前
多核架构中,RTOS小核跑sensor 的normal模式,大核linux核跑WDR模式,将小核的曝光时间映射到WDR模式中的曝光时间的方法
linux·自动曝光·wdr
全栈测试笔记1 小时前
异步函数与异步生成器
linux·服务器·前端·数据库·python
weixin_462446231 小时前
Linux 下使用 xfreerdp3 远程连接 Windows(从安装到实战使用)
linux·运维·windows
EndingCoder1 小时前
配置 tsconfig.json:高级选项
linux·前端·ubuntu·typescript·json
爱丶狸1 小时前
Linux三剑客之sed
linux·运维·服务器
China_Yanhy2 小时前
区块链运维日记 · 第 1 日 :消失的 2000 笔提现 —— 致命的 Nonce 冲突
运维·区块链
趁着年轻吃点苦2 小时前
录用通知-自助系统的服务器部署指南
运维·服务器
仗剑恬雅人2 小时前
LINUX数据库高频常用命令
linux·运维·服务器·数据库·ssh·运维开发