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能够正常登录设备进行远程访问。

相关推荐
HelloWorld_SDK24 分钟前
Docker安装OpenClaw
运维·docker·容器·openclaw
REDcker42 分钟前
Linux iptables 与 Netfilter:原理、路径与运维要点
linux·运维·服务器
KKKlucifer2 小时前
零信任融合实践:国内堡垒机如何落地动态权限与实时阻断
运维
嵌入式×边缘AI:打怪升级日志2 小时前
Linux 驱动开发入门:从最简单的 hello 驱动到硬件交互
linux·驱动开发·交互
Bert.Cai3 小时前
Linux useradd命令详解
linux·运维
无忧.芙桃4 小时前
进程控制(上)
linux·运维·服务器
十年编程老舅4 小时前
深入 Linux 中断:原理详解 + 实战落地
linux·网络·linux内核·c/c++·中断
Bert.Cai4 小时前
Linux rm命令详解
linux·运维
航Hang*4 小时前
Windows Server 配置与管理——第8章:配置Web服务器
运维·服务器·windows·学习·vmware
知识浅谈5 小时前
OpenClaw保姆级安装教程:基于ubuntu系统
linux·ubuntu·node.js