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

相关推荐
爱跑马的程序员几秒前
Linux 如何查看文件夹的大小(du、df、ls、find)
linux·运维·ubuntu
YounGp_oo4 分钟前
一次内网开发环境访问方式的改进实践:使用 FRP 替代远程桌面
网络·ssh·frp·内网穿透·开发环境
代码AI弗森2 小时前
n8n 专题:从“自动化脚本”到“可视化工作流引擎”(自建、节点、Webhook、生产部署)
运维·自动化
oMcLin2 小时前
如何在 Ubuntu 22.04 LTS 上部署并优化 Magento 电商平台,提升高并发请求的响应速度与稳定性?
linux·运维·ubuntu
Qinti_mm2 小时前
Linux io_uring:高性能异步I/O革命
linux·i/o·io_uring
优雅的38度2 小时前
linux环境下,使用docker安装apache kafka (docker-compose)
linux·架构
小李独爱秋3 小时前
计算机网络经典问题透视:TLS协议工作过程全景解析
运维·服务器·开发语言·网络协议·计算机网络·php
想唱rap3 小时前
表的约束条件
linux·数据库·mysql·ubuntu·bash
山上三树3 小时前
对比用户态线程与内核态轻量级进程
linux
2501_948195343 小时前
RN for OpenHarmony英雄联盟助手App实战:设置实现
linux·ubuntu