• ssh连接虚拟机失败解决办法


    首先,你需要知道本机IP跟虚拟机IP,然后让两者互相ping一下,看能否ping通

    让主机ping虚拟机 :ping (虚拟机ip)

    出现如下:

    表示主机可以ping通虚拟机

    然后让虚拟机ping主机

    出现如下所示,表示可以ping通

    然后在虚拟机的终端上输入:ssh localhost

    出现如下;

    则是说你的虚拟机没有安装ssh

    然后再输入:sudo apt-get install openssh-server

    然后根据提示输入yes(y)确认安装就行了

    安装完之后输入:ps -e|grep ssh

    来判断ssh是否开启,如果开启,会出现sshd的字样,要是没有开启,需要/etc/init.d/ssh start来开启

    开启后如果还是在来进行连接,如果还是无法连接,出先如下图:

    那么需要配置/etc/ssh/sshd_config文件,输入:vi(vim) /etc/ssh/sshd_config

    在这个文件后面添加下列配置

    Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc

    MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96

    KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org

    保存退出,然后重新启动ssh,输入:sudo service ssh restart

    这样就可以ssh客户端进行连接了。

    PS:如果这样还无法连接,可能是是防火墙未开放相应端口的原因,一般Ubuntu默认的端口是22,所以在防火墙设置中,选择高级设置,选择入站规则,选择新建规则,选择端口,选择tcp,在特定本地端口栏填写相应的端口号,保存就完成了。

    PS2:查看Ubuntu的端口方法:cat /etc/ssh/sshd_config

  • 相关阅读:
    模仿.Net ThreadPool的线程池控件
    ThreadPool for Delphi
    Thread Pool Engine, and Work-Stealing scheduling algorithm
    Delphi ThreadPool 线程池(Delphi2009以上版本适用)
    Object Pascal对象模型中构造函数之研究
    TExternalThread TThread -- Delphi -- Cannot terminate an externally created thread ?
    Trapping Messages Sent to an Application
    Correct thread terminate and destroy
    Delphi thread exception mechanism
    VCL -- Understanding the Message-Handling System
  • 原文地址:https://www.cnblogs.com/fengyuhuawu/p/7367619.html
Copyright © 2020-2023  润新知