centos 7 升级 openssh

图片[1]-centos 7 升级 openssh-JoyCode 编程小战

安装telnet:

yum install -y xinetd telnet-server

配置文件添加终端类型:

vim /etc/securetty

配置文件加入:

pts/0
pts/1
pts/2
pts/3

修改默认端口:

vi /etc/services
vi /usr/lib/systemd/system/telnet.socket

开启telnet服务:

systemctl start telnet.socket
systemctl enable telnet.socket

zlib下载地址:http://www.zlib.net/

编译安装zlib:

./configure --prefix=/usr/local/zlib;
 
make && make install;
 
echo '/usr/local/zlib/lib' >> /etc/ld.so.conf;

ldconfig -v;

OpenSSL下载地址:https://ftp.openssl.org/source/

编译安装openssl:

 ./config --prefix=/usr/local/openssl  --sysconfdir=/etc/ssh --shared && make && make install

创建软链:

ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl

也可用yum 安装openssl:

yum install openssl-devel

配置链接库加载:

echo '/usr/local/ssl/lib' >> /etc/ld.so.conf;
ldconfig -v;

卸载系统旧版本openssh:

rpm -qa|grep openssh|grep openssh |xargs rpm -e --nodeps;
rpm -qa|grep openssh;

OpenSSH下载地址:https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/

编译安装openssh:

./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/ssl --with-zlib=/usr/local/zlib --sysconfdir=/etc/ssh;
make && make install;

替换可执行文件:

cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd;
cp /usr/local/openssh/bin/ssh /usr/bin/ssh;
cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen;

配置服务:

cp -p contrib/redhat/sshd.init /etc/init.d/sshd;
systemctl enable sshd;

启动服务:

systemctl start sshd;

参考:

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享