1. 程式人生 > >CentOS openssh升級至7.4版本

CentOS openssh升級至7.4版本

rds 根據 devel 宋體 als ted per 修改 .gz

1.原環境:

cat /etc/issue

CentOS release 6.5 (Final)

ssh -V

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

2.備份ssh目錄:

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

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

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

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

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 restart

9.查看升級後的版本:
ssh -V
OpenSSH_7.4p1, OpenSSL 1.0.1e-fips 11 Feb 2013




原文出處:http://blog.csdn.net/zhangguoliang521/article/details/62042306

CentOS openssh升級至7.4版本