• Ubuntu 14.04.2升级openssh7.9


    环境:Ubuntu 14.04.2

    目的:openssh版本6.6升级为openssh7.9

    准备以下3个包

    http://www.zlib.net/

    https://www.openssl.org/source/ 

    http://www.openssh.com/portable.html

    避免升级出现错误导致ssh服务挂掉,会导致一系列的麻烦事,所以提前安装telnet服务

    apt-get install openbsd-inetd telnetd telnet
    /etc/init.d/openbsd-inetd restart     # 启动服务
    netstat -anpt|grep 23                 # 查看telnet服务的默认端口是否启动
    telnet ip                             # 测试是否成功登陆
    

    此处可能会遇到:安装telnet 后,root登录时总是提示 login incorrect

     vim /etc/pam.d/login 注释文件中的32行即可

    上传zlib源码到服务器的任意目录,并解压
    tar xf zlib-1.2.11.tar.gz
    ./configure    --prefix=/usr/local/zlib
    make && make  install

    更新动态链接数据库

     echo "/usr/local/zlib/lib" >> /etc/ld.so.conf
     ldconfig -v
    

     编译安装openssl

    tar xf openssl-1.1.0k.tar.gz
    ./config  shared && make && make install
    ln -s /usr/local/bin/openssl /usr/bin/openssl  (注意此处软链接需要按住实际路径)
    ln -s /usr/local/include/openssl /usr/include/openssl(注意此处软链接需要按住实际路径)
    echo "/usr/local/ssl/lib" > /etc/ld.so.conf.d/openssl.conf 
    ldconfig -v

    查询openssl版本号

     编译安装openssh

    tar xf openssh-7.9p1.tar.gz 
    mv /etc/ssh /etc/ssh_bak  (备份该目录)
    mv /etc/init.d/ssh /etc/init.d/ssh_bak (备份该目录)
    cd openssh-7.9p1/
    ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local --with-privsep-path=/var/lib/sshd
    make && make install
    

     执行ssh -V验证是否升级成功

    拷贝源文件目录中的sshd.init

     cp -p contrib/redhat/sshd.init /etc/init.d/sshd

    vim /etc/ssh/sshd_config  修改配置中的以下参数,使之和原来配置信息保持一致

    Port 22
    #PermitRootLogin prohibit-password
    PermitRootLogin yes
    ln -s /lib/lsb/init-functions /etc/rc.d/init.d/functions

     重启service sshd restart,此处可以看到一个command not found的报错,经过验证该报错不影响ssh服务启动,暂时没找到原因,经验证ubuntu 16.04 及以上版本系统中没有此问题。猜测是/etc/init.d/sshd配置文件中某个参数不对

    执行以下命令查询ssh服务是否正常启动

    ps -ef | grep ssh

    netstat -lnutp|grep sshd

    加入开机启动项ubuntu中chkconfig已经被sysv-rc-conf替代

     sysv-rc-conf sshd on

     执行sysv-rc-conf --list|grep sshd命令验证是否加入成功

  • 相关阅读:
    NET5 ORM 六大新功能
    牛逼程序员必须要掌握金字塔思维
    实体类转Json的2种方法
    怎么使用jquery阻止页面的离开或卸载
    GitHub的用法:到GitHub上部署项目
    搭建个人服务器
    远程服务器上部署本地项目
    java.nio.ByteBuffer中flip,rewind,clear方法的区别
    eclipse Run On Server 异常:could not load the Tomcat Server configuration at Servers omcat V5.0 Sertomcat
    throw与throws的区别
  • 原文地址:https://www.cnblogs.com/caidingyu/p/11126852.html
Copyright © 2020-2023  润新知