Ubuntu20上執行如下命令查看是否存在ssh服務
#ps -e | grep ssh
只有ssh-agent,沒有sshd; 因此要安裝openssh-server.
搜索openssh-server,得到下載鏈接:
openssh-server
復制這個Binary Package鏈接即可下載,然后使用如下命令安裝
sudo dpkg -i? binary_file?
這個時候會提示版本不對,依賴也有缺陷
那么就去選擇正確的版本,依然在剛才那個頁面,兩個文件都下載好后,繼續安裝,就成功了
sftp
這個時候再去查看服務,發現:
打開ssh終端來連接這個服務器
這個時候,你可能會遇到Key exchange failed的問題;原因是服務器端sshd支持的密鑰交換策略與你使用的終端,比如secureCRT支持的終端不一致,尤其是老版本的secureCRT,比如6.5,就不支持新的策略:
Key exchange failed. No compatible key exchange method.
The server supports these methods:
curve25519-sha256,
curve25519-sha256@libssh.org,
ecdh-sha2-nistp256,ecdh-sha2-nistp384,
ecdh-sha2-nistp521,
diffie-hellman-group-exchange-sha256,
diffie-hellman-group16-sha512,
diffie-hellman-group18-sha512,
diffie-hellman-group14-sha256
這個時候,要么更換更高版本的securecrt,要么新增支持的策略。
可以修改/etc/ssh/sshd_config, 記住是 sshd_config? 不是 ssh_config。
SecureCRT SSH連接報錯Key exchange failed 問題處理記錄_feverlook-騰訊云開發者社區
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
添加如上這行,就可以了;
此外,putty會支持各種策略,即使secureCRT連不上,putty可以連上