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

相关推荐
Arvin6271 小时前
Nginx 添加账号密码访问验证
运维·服务器·nginx
风曦Kisaki2 小时前
# Linux 磁盘查看命令详解:df 与 du
linux·运维·网络
路溪非溪2 小时前
Linux中gpio子系统的现代接口
linux·arm开发·驱动开发
攻城狮在此2 小时前
华为交换机Console口密码如何清除
运维·网络·华为
特别关注外国供应商2 小时前
SSH PrivX™ OT 案例 - 某船舶运营商为数千艘船舶实现了远程访问,用于诊断、维护和物联网数据采集
物联网·ssh·数据采集·ad·远程访问·多因素身份验证·privx
内心的一片海3 小时前
服务器内存异常占用
运维·服务器
文静小土豆3 小时前
Centos7负载异常过高排查思路(Load Average)
linux
Deitymoon3 小时前
linux——原子操作
linux
亚空间仓鼠4 小时前
OpenEuler系统常用服务(四)
linux·运维·服务器·网络
MichealChen0105084 小时前
Influxdb-cluster使用docker部署
运维·docker·容器