ssh不能登陆问题

这几天重装了系统,发现本机sshd服务开启但是其他机器不能登陆,看了一下/var/log/auth.log的日志,出现很多下面这样的错误:

Sep 28 20:59:38 localhost sshd[27399]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep 28 20:59:38 localhost sshd[27399]: error: @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
Sep 28 20:59:38 localhost sshd[27399]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep 28 20:59:38 localhost sshd[27399]: error: Permissions 0644 for '/etc/ssh/ssh_host_rsa_key' are too open.
Sep 28 20:59:38 localhost sshd[27399]: error: It is required that your private key files are NOT accessible by others.
Sep 28 20:59:38 localhost sshd[27399]: error: This private key will be ignored.
Sep 28 20:59:38 localhost sshd[27399]: error: bad permissions: ignore key: /etc/ssh/ssh_host_rsa_key
Sep 28 20:59:38 localhost sshd[27399]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Sep 28 20:59:38 localhost sshd[27399]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep 28 20:59:38 localhost sshd[27399]: error: @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
Sep 28 20:59:38 localhost sshd[27399]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep 28 20:59:38 localhost sshd[27399]: error: Permissions 0644 for '/etc/ssh/ssh_host_dsa_key' are too open.
Sep 28 20:59:38 localhost sshd[27399]: error: It is required that your private key files are NOT accessible by others.
Sep 28 20:59:38 localhost sshd[27399]: error: This private key will be ignored.
Sep 28 20:59:38 localhost sshd[27399]: error: bad permissions: ignore key: /etc/ssh/ssh_host_dsa_key
Sep 28 20:59:38 localhost sshd[27399]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key
Sep 28 20:59:38 localhost sshd[27399]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep 28 20:59:38 localhost sshd[27399]: error: @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
Sep 28 20:59:38 localhost sshd[27399]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep 28 20:59:38 localhost sshd[27399]: error: Permissions 0644 for '/etc/ssh/ssh_host_ecdsa_key' are too open.
Sep 28 20:59:38 localhost sshd[27399]: error: It is required that your private key files are NOT accessible by others.
Sep 28 20:59:38 localhost sshd[27399]: error: This private key will be ignored.
Sep 28 20:59:38 localhost sshd[27399]: error: bad permissions: ignore key: /etc/ssh/ssh_host_ecdsa_key
Sep 28 20:59:38 localhost sshd[27399]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Sep 28 20:59:38 localhost sshd[27399]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep 28 20:59:38 localhost sshd[27399]: error: @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
Sep 28 20:59:38 localhost sshd[27399]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep 28 20:59:38 localhost sshd[27399]: error: Permissions 0644 for '/etc/ssh/ssh_host_ed25519_key' are too open.
Sep 28 20:59:38 localhost sshd[27399]: error: It is required that your private key files are NOT accessible by others.
Sep 28 20:59:38 localhost sshd[27399]: error: This private key will be ignored.
Sep 28 20:59:38 localhost sshd[27399]: error: bad permissions: ignore key: /etc/ssh/ssh_host_ed25519_key
Sep 28 20:59:38 localhost sshd[27399]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
可以很容易看出来这是因为ssh服务的配置文件的访问权限有问题,配置文件路径为/etc/ssh,将这些文件的权限修改为如下即可:

drwxr-xr-x   2 root root   4096  9月 28 20:48 ./
drwxr-xr-x 151 root root  12288  9月 28 20:50 ../
-rw-r--r--   1 root root 242091  4月 14 20:13 moduli
-rw-r--r--   1 root root   1690  4月 14 20:13 ssh_config
-rw-r--r--   1 root root   3917  9月 28 20:49 sshd_config
-rw-------   1 root root    668  9月  9 16:55 ssh_host_dsa_key
-rw-r--r--   1 root root    618  9月  9 16:55 ssh_host_dsa_key.pub
-rw-------   1 root root    227  9月  9 16:55 ssh_host_ecdsa_key
-rw-r--r--   1 root root    190  9月  9 16:55 ssh_host_ecdsa_key.pub
-rw-------   1 root root    419  9月  9 16:55 ssh_host_ed25519_key
-rw-r--r--   1 root root    110  9月  9 16:55 ssh_host_ed25519_key.pub
-rw-------   1 root root   1675  9月  9 16:55 ssh_host_rsa_key
-rw-r--r--   1 root root    410  9月  9 16:55 ssh_host_rsa_key.pub
-rw-r--r--   1 root root    338  9月  9 16:55 ssh_import_id


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值