SSH Client鏈接Ubuntu Server失敗解法

經過虛擬機安裝完ubuntu-15.04-server-amd64以後我作了一些設置(清屏快捷鍵:Ctrl + L)算法

  • 爲root用戶設置密碼ubuntu

    sudo passwd root

    系統會提示先輸入當前用戶的密碼進行驗證,而後會爲root用戶輸入兩次新密碼進行密碼設置。設置成功會提示「password updated successfully」。vim

  • 切換當前用戶爲root服務器

    sudo su

    而後輸入剛纔設置的新密碼便可切換爲root用戶。ssh

  • 更新系統和軟件包工具

    apt-get update && apt-get -y upgrade

    耐心等待更新完成···spa

  • 安裝文本編輯工具vim和遠程工具openssh-server3d

    apt-get -y install vim openssh-server
  • 啓動ssh並查看其運行狀態rest

    service ssh start && ps -e | grep ssh

    看到相似「50520 ? 00:00:00 sshd」的字樣說明ssh服務已啓動,若是你如今就用SSH Client鏈接該host的話極可能會鬱悶喲!而鬱悶的根源極可能是Server responded "Algorithm negotiation failed",聽說是客戶端跟服務器端採用的壓縮算法不一樣致使的。clipboard.pngcode

  • 解決Server responded "Algorithm negotiation failed"的問題

    # 修改ssh的配置文件
    vim /etc/ssh/sshd_config
    
    # 容許root用戶登陸,將「PermitRootLogin without-password」更改成
    PermitRootLogin yes
    
    # 在配置文件中添加以下內容(除了第三條的最後一個是灰色加紫色,其餘的是藍色,若是是灰色說明不對!)
    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
  • 保存並退出後重啓sshd服務

    sudo service ssh restart
  • 查詢ip地址

    ifconfig
    # 或者
    ip addr show eth0

    而後根據ip鏈接就不會再出現此問題了。第一次鏈接會出現該提示,是否保存key,選擇Yes!

clipboard.png
鏈接成功了···
clipboard.png

相關文章
相關標籤/搜索