sshを開く------リモートログインに失敗した問題を解決する


他の人があなたのパソコンにログインできないか、サーバーにログインできない場合があります.最も発生する可能性のある問題はsshに問題が発生したことです.
[root@zong_pc zong]# /etc/init.d/sshd status      // linux   ssh   
openssh-daemon (pid  2309)     ...
[root@zong_pc zong]# 

[root@zong_pc zong]# /etc/init.d/sshd start       //  ssh      ,         
 
[root@zong_pc /]# /etc/init.d/sshd close
  : /etc/init.d/sshd {start|stop|restart|reload|force-reload|condrestart|try-restart|status}
[root@zong_pc /]# /etc/init.d/sshd stop
   sshd:                                                [  ]
[root@zong_pc /]# /etc/init.d/sshd status
openssh-daemon   
[root@zong_pc /]# /etc/init.d/sshd start
     sshd:                                            [  ]
[root@zong_pc /]# /etc/init.d/sshd stop
   sshd:                                                [  ]
[root@zong_pc /]# 

以下の方法で直接操作できます.
vim /etc/ssh/sshd_config        
      : 
 39 # Authentication:
 40 
 41 #LoginGraceTime 2m
 42 PermitRootLogin no          
 43 #StrictModes yes
 44 #MaxAuthTries 6
 45 #MaxSessions 10
 46

 PermitRootLogin     no,         :
[root@zong_pc ssh]# ssh 192.168.40.223
ssh: connect to host 192.168.40.223 port 22: No route to host




      ::
  ,          yes    。PermitRootLogin  yes
     ,
   ssh:/etc/init.d/sshd start
  ssh       /etc/init.d/sshd restart
 
  
  
 

当然,也可能出现下面这种情况:

[root@localhost zhangna]# ssh 192.168.40.22
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
8b:d9:17:7d:97:d5:19:02:a1:27:9f:cc:b8:31:20:34.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:1
RSA host key for 192.168.40.22 has changed and you have requested strict checking.
Host key verification failed.
[root@localhost zhangna]# rm -rf /root/.ssh/known_hosts
 [root@localhost zhangna]# ssh 192.168.40.22
The authenticity of host '192.168.40.22 (192.168.40.22)' can't be established.
RSA key fingerprint is 8b:d9:17:7d:97:d5:19:02:a1:27:9f:cc:b8:31:20:34.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.40.22' (RSA) to the list of known hosts.
Address 192.168.40.22 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
[email protected]'s password: 
Last login: Wed Jan 13 10:46:24 2016 from 192.168.40.222
[root@localhost ~]#