Centos7升級OpenSSH
1、下載相關依賴包
# yum install -y gcc openssl-devel pam-devel rpm-build
2、 下載安裝包
wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.9p1.tar.gz
3、解除安裝原Openssh
[[email protected] ~]# rpm -qa |grep openssh
openssh-7.4p1-16.el7.x86_64
openssh-clients-7.4p1-16.el7.x86_64
openssh-server-7.4p1-16.el7.x86_64
[[email protected] ~]# for i in $(rpm -qa |grep openssh);do rpm -e $i --nodeps;done
4、解壓openssh安裝包
tar -xvf openssh-7.9p1.tar.gz
[[email protected] openssh-7.9p1]# cd openssh-7.9p1
5、編譯安裝
[[email protected] openssh-7.9p1]# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords--with-pam --with-tcp-wrappers --with-ssl-dir=/usr/local/ssl --without-hardening
[
[[email protected] openssh-7.9p1]# make && make install
6、安裝完成,執行配置
[[email protected] openssh-7.8p1]# cp contrib/redhat/sshd.init /etc/init.d/sshd [[email protected] openssh-7.8p1]# chkconfig --add sshd [[email protected] openssh-7.8p1]# chkconfig sshd on [
[[email protected] openssh-7.8p1]# systemctl restart sshd
7、檢視版本
[[email protected] openssh-7.9p1]# systemctl status sshd
● sshd.service - SYSV: OpenSSH server daemon
Loaded: loaded (/etc/rc.d/init.d/sshd; bad; vendor preset: enabled)
Active: active (running) since Fri 2018-11-16 20:01:38 CST; 3min 42s ago
Docs: man:systemd-sysv-generator(8)
Process: 47313 ExecStart=/etc/rc.d/init.d/sshd start (code=exited, status=0/SUCCESS)
Main PID: 47319 (sshd)
CGroup: /system.slice/sshd.service
└─47319 /usr/sbin/sshd
Nov 16 20:01:38 test systemd[1]: Starting SYSV: OpenSSH server daemon...
Nov 16 20:01:38 test sshd[47313]: Starting sshd:[ OK ]
Nov 16 20:01:38 test systemd[1]: PID file /var/run/sshd.pid not readable (yet?) after start.
Nov 16 20:01:38 test sshd[47319]: Server listening on 0.0.0.0 port 22.
Nov 16 20:01:38 test sshd[47319]: Server listening on :: port 22.
Nov 16 20:01:38 test systemd[1]: Started SYSV: OpenSSH server daemon.
centos7 openssh升級指令碼
rpm -qa |grep openssh
for i in $(rpm -qa |grep openssh);do rpm -e $i --nodeps;done
tar -xvf openssh-7.9p1.tar.gz
cd openssh-7.9p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords--with-pam --with-tcp-wrappers --with-ssl-dir=/usr/local/ssl --without-hardening
rm -rf /etc/ssh
make && make install
cp contrib/redhat/sshd.init /etc/init.d/sshd
chkconfig --add sshd
chkconfig sshd on
chkconfig --list|grep sshd
sed -i "32a PermitRootLogin yes" /etc/ssh/sshd_config
systemctl restart sshd
systemctl status sshd