记一次因为乱给权限导致ssh无法访问的问题

在一次服务器上的项目复制移到另一台服务器上时,两台服务器都是linux的,因为乱给了etc下面的文件 chmod -R +xxx /etc/* 的权限,因为复制mysql的时候有该目录下的文件需要权限,所以就这样直接给了这个目录下全部文件的这个权限,结果ssh立刻不能访问了。

sshd -t 命令检查 发现

Permissions 0777 for '/etc/ssh/ssh_host_rsa_key' are too open 意思是说这个文件给的权限太高了,这样也是不行的,然后把所有的这样与ssh相关的文件权限改成

chmod 600 /etc/ssh/etc/ssh/ssh_host_rsa_key

这样,再运行 systemctl start sshd 就可以启动了。然后再试着远程连接就连上了

相关报错

执行 :systemclt status sshd.service 显示如下错误

● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: activating Cauto-restart)(Result: exit-code) since Sun 2021-89-05 09: 30: 18 CST: 12s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
   Process: 13561 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=1/FAILURE)
  Main pid: 13561 (code=exited status=1/FAIlURE)
Sep 85 89: 30: 18 VM-8-16-centos sshd[13561]: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep B5 89: 30: 18 VM-9-16-centos sshd[13561]: Permissions 8644 for/etc/ssh/ssh_host_ed25519_key‘are too open
Sep 05 89: 30: 18 VM-0-16-centos sshd[13561]:It is required that your private key files are NoT accessible by others
Sep 05 89: 30: 18 VM-0-16-centos sshd[13561]: This private key will be ignored
Sep 85 89: 30: 18 UM-0-16-centos sshd[13561]: key_load_private: bad permissions
Sep 05 89: 30: 18 UM-0-16-centos sshd[13561]: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Sep 05 89: 30: 18 VM-8-16-centos sshd[13561]: sshd: no hostkeys available -- exiting
Sep 05 89: 30: 18 UM-0-16-centos system[1]: Failed to start OpenSSH server daemon
Sep 05 89: 30: 18 UM-0-16-centos systemd[1]: Unit sshd.service entered failed state
Sep 05 89: 36: 18 UM-0-16-centos systemd[1]: sshd.service failed
[root@VM-0-16-centos /]#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值