已经正常安装ssh: connect to host 192.168.4.254 port 22: Connection refused

SSH无法正常启动,运行service sshd status 结果如下,

[root@localhost ~]# service sshd status
Redirecting to /bin/systemctl status sshd.service
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since 四 2019-04-25 10:46:11 CST; 16s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 18143 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=1/FAILURE)
 Main PID: 18143 (code=exited, status=1/FAILURE)
    Tasks: 0
   CGroup: /system.slice/sshd.service

4月 25 10:46:11 localhost.localdomain sshd[18143]: Permissions 0737 for '/et...
4月 25 10:46:11 localhost.localdomain sshd[18143]: It is required that your ...
4月 25 10:46:11 localhost.localdomain sshd[18143]: This private key will be ...
4月 25 10:46:11 localhost.localdomain sshd[18143]: key_load_private: bad per...
4月 25 10:46:11 localhost.localdomain sshd[18143]: Could not load host key: ...
4月 25 10:46:11 localhost.localdomain sshd[18143]: sshd: no hostkeys availab...
4月 25 10:46:11 localhost.localdomain systemd[1]: sshd.service: main process...
4月 25 10:46:11 localhost.localdomain systemd[1]: Failed to start OpenSSH se...//失败
4月 25 10:46:11 localhost.localdomain systemd[1]: Unit sshd.service entered ...
4月 25 10:46:11 localhost.localdomain systemd[1]: sshd.service failed.

测试,将文件权限修改600

[root@localhost ~]# /usr/sbin/sshd -t
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0737 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 0737 for '/etc/ssh/ssh_host_ecdsa_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_ecdsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0737 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
Could not load host key: /etc/ssh/ssh_host_ed25519_key
sshd: no hostkeys available -- exiting.
[root@localhost ~]# chmod 600 /etc/ssh/ssh_host_rsa_key
[root@localhost ~]# chmod 600 /etc/ssh/ssh_host_ecdsa_key
[root@localhost ~]# chmod 600 /etc/ssh/ssh_host_ed25519_key
[root@localhost ~]# /usr/sbin/sshd -t


正常

 

你可能感兴趣的:(已经正常安装ssh: connect to host 192.168.4.254 port 22: Connection refused)