共計(jì) 1870 個(gè)字符,預(yù)計(jì)需要花費(fèi) 5 分鐘才能閱讀完成。
這篇文章主要講解了“ubuntu 如何安裝 openssh 服務(wù)器”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著丸趣 TV 小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“ubuntu 如何安裝 openssh 服務(wù)器”吧!
1. 安裝 openssh 首先得安裝 openssl 和 zlib
安裝 openssl — 下載 openssl-1.0.1j.tar.gz, 解壓到 /usr/openssl/ 目錄下進(jìn)入解壓目錄 執(zhí)行./config -fpic 如下圖
安裝 zlib— 下載 zlib-1.2.8.tar.gz 解壓到 /usr/zlib/ 目錄下
執(zhí)行./configure make 和 make install 命令 ok
2. 下載 openssh.tar.gz 包解壓放在 /usr/openssh/ 目錄下 解壓 如圖
執(zhí)行 ./configure 之后部分編譯如下 可以看到 openssh 的配置文件放在了 /usr/local/etc 下注意:一般情況下在 /etc/ssh 目錄下
openssh has been configured with the following options:
user binaries: /usr/local/bin
system binaries: /usr/local/sbin
configuration files: /usr/local/etc
askpass program: /usr/local/libexec/ssh-askpass
manual pages: /usr/local/share/man/manx
pid file: /var/run
privilege separation chroot path: /var/empty
沒(méi)有 –with-ssl-dir=/usr/local/ssl 可能會(huì)報(bào) configure: error: openssl version header not found 執(zhí)行 make 和 make install 命令 報(bào)錯(cuò):privilege separation user sshd does not exist 解決:在 /etc/passwd 中加入:sshd:x:74:74:privilege-separatedssh:/var/empty/sshd:/sbin/nologin 再次 make install 編譯安裝成功。
openssh 默認(rèn)安裝在 /usr/local/sbin/ 目錄下如圖
開(kāi)啟 ssh 服務(wù)
注意要按照絕對(duì)路徑開(kāi)啟 ssh 服務(wù)否則報(bào)錯(cuò)
查看 ssh 是否啟動(dòng)成功
通過(guò) putty 連接服務(wù)器
打開(kāi)
打開(kāi)
連接登陸成功
通過(guò) ssh 遠(yuǎn)程登陸
報(bào)錯(cuò) server responded algorithm negotiation failed 原因 客戶(hù)端與服務(wù)端的壓縮方式不一樣
解決方法 修改 ssh 的配置文件一般在 /etc/ssh/sshd_config 但是我這里是在 /usr/local/etc/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
重啟 sshd 服務(wù)后,即可正常連接,如下圖。
點(diǎn)擊 yes 輸入密碼
點(diǎn)擊 ok
成功
設(shè)置 ssh 開(kāi)機(jī)啟動(dòng),編輯 /etc/rc.local 文件
感謝各位的閱讀,以上就是“ubuntu 如何安裝 openssh 服務(wù)器”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì) ubuntu 如何安裝 openssh 服務(wù)器這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是丸趣 TV,丸趣 TV 小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!