1. 程式人生 > >centos升級ssh

centos升級ssh

最新版 body led port https openssh login authent per

服務器漏洞掃描,提示很多ssh漏洞,原因是因為centos6.5的ssh版本太低,需要升級。

升級步驟:

1、備份ssh目錄

mv /etc/ssh /etc/ssh-bak或

cp -rf /etc/ssh /etc/ssh-bak

2、下載ssh最新版,我下載的是openssh-7.6p1.tar.gz

http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/

3、執行安裝命令

tar -zxvf openssh-7.6p1.tar.gz

cd openssh-7.6p1

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords --with-tcp-wrappers
(在執行以上這條命令時,如出現error的錯誤,代表這裏缺少依賴包,可根據不同提示信息進行下載安裝,缺少包的情況會有:zlib、openssl-devel、pam等)

註:此處我遇到錯誤提示configure: error: PAM headers not found,執行yum install pam-devel -y

make && make install

4、修改配置文件/etc/ssh/sshd_config

PermitRootLogin 項 改為yes

PasswordAuthentication 值改為yes

5、重啟ssh

service sshd restart

註:此處我遇到錯誤提示:Generating SSH1 RSA host key: FAILED,百度上未搜到解決辦法,後來想起之前備份的/etc/ssh,恢復到以前的,問題解決。

6、查看ssh版本

ssh -V

參考資料:

https://www.cnblogs.com/dukeShi/p/8134061.html

http://blog.c1gstudio.com/archives/1474

https://blog.csdn.net/lqy461929569/article/details/76148598

https://blog.csdn.net/u012259256/article/details/59546084

centos升級ssh