CentOS7安装OpenSSH

systemctl stop sshd.service
rpm -e openssh-server
rpm -e openssh-clients --nodeps
rpm -e openssh --nodeps
rm -rf /etc/ssh

停止并卸载旧版本SSH

wget https://cloudflare.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.9p1.tar.gz
tar zxf openssh-7.9p1.tar.gz
cd openssh-7.9p1
./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl --with-zlib=/usr/local/zlib --with-md5-passwords && make && make install

下载,解压,安装

cp contrib/redhat/sshd.init /etc/init.d/sshd
chmod +x /etc/init.d/sshd

复制自启动脚本并授权

vi /etc/init.d/sshd
vi /etc/ssh/sshd_config
chkconfig --add sshd
service sshd start

编辑配置文件,添加到开机启动,运行