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

相关推荐
学无止境_永不停歇21 分钟前
9. 缓冲区
linux·服务器·c++
dok1225 分钟前
Johannes 《Linux内核模块与设备驱动开发:编写Linux驱动程序》(4) devicefile 设备号相关
linux·运维·服务器
毛驴赶鹿1 小时前
低配置服务器怎么搭建监控?Komari Docker部署与公网访问完整教程
运维·服务器·docker
Fu2067211 小时前
结课项目考试
linux·运维·服务器
MXsoft6181 小时前
## 信创运维2.0的“最后一公里”——国产设备“能用但不好用”,问题出在哪?
运维
Albert·Lin1 小时前
LVS相关知识点总结-一
linux·服务器·lvs
公众号:fuwuqiBMC2 小时前
(转自“服务器BMC”)服务器BMC芯片——AST1840
运维·服务器·fpga开发
芳草萋萋鹦鹉洲哦3 小时前
【git】重新生成并添加 SSH Key(Mac)
git·macos·ssh
tianyuanwo3 小时前
深入理解 Linux 启动救援模式与控制台选择:从 x86 的 tty0 到 ARM 的 ttyS0
linux·grub·救援系统
爱网络爱Linux3 小时前
RHCSA+RHCE 10.0全新升级!红帽Ansible自动化运维
运维·自动化·ansible·rhce认证·rhel1o·linux10·rhce10