CentOS openssh升級至7.4版本

1.原環境:linux

cat /etc/issuewindows

CentOS release 6.5 (Final)安全

 

ssh -V服務器

OpenSSH_7.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013app

 

2.備份ssh目錄:ssh

cp -rf /etc/ssh /etc/ssh.baksocket

 

3.首先查看本機telnet安裝狀況,若有輸出則無需再進行安裝:rpm -qa telnet-servertcp

 

4.如無telnet則需進行安裝,避免ssh升級出現問題,沒法遠程管理:yum install telnet-server測試

(安裝好telnet後,爲確保安全,需提早測試是否能在windows系統下telnet鏈接至linux服務器)spa

 

5.修改配置文件:

vi /etc/xinetd.d/telnet
service telnet
{
        flags           = REUSE
        socket_type     = stream
        wait           = no
        user           = root
        server          = /usr/sbin/in.telnetd
        log_on_failure  += USERID
        disable         = no
}
默認不容許root登陸,
vi /etc/securetty增長
pts/0
pts/1
pts/2
/etc/init.d/xinetd restart
這樣root能夠telnet登陸了

6.解壓安裝ssh:
openssh7.4的安裝包:http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/
找到openssh-7.4p1.tar.gz 下載
便可


tar -zxvf openssh-7.4p1.tar.gz 

cd openssh-7.4p1

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

make

make install

安裝成功後會提示:
/etc/ssh/ssh_config already exists, install will not overwrite
/etc/ssh/sshd_config already exists, install will not overwrite
/etc/ssh/moduli already exists, install will not overwrite
ssh-keygen: generating new host keys: ECDSA ED25519 
/usr/sbin/sshd -t -f /etc/ssh/sshd_config
/etc/ssh/sshd_config line 81: Unsupported option GSSAPIAuthentication
/etc/ssh/sshd_config line 83: Unsupported option GSSAPICleanupCredentials

7.修改配置文件,容許root登陸:
vi /etc/ssh/sshd_config
#PermitRootLogin yes
修改成
PermitRootLogin yes

命令:sed -i '/^#PermitRootLogin/s/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config

8.重啓openssh
service sshd restart9.查看升級後的版本:ssh -V OpenSSH_7.4p1, OpenSSL 1.0.1e-fips 11 Feb 2013原文出處:http://blog.csdn.net/zhangguoliang521/article/details/62042306
相關文章
相關標籤/搜索