标签:user cal passwords 下载 开启 info font sshd_conf openssh
(一) 升级条件准备
² 关闭防火墙
# ufw disable
² 安装与启用telnet
开启telnet server,以防止升级OpenSSH时导致远程连接异常,具体Telnet服务安装与开启命令操作如下。
# apt-get install -y openbsd-inetd
# apt-get install -y telnetd
# service openbsd-inetd start
² 下载相关升级包
# wget https://cloudflare.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.4p1.tar.gz --no-check-certificate
# wget http://www.zlib.net/zlib-1.2.11.tar.gz
# wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
² 安装zlib依赖库
# tar zxvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure
# make && make install
# echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig
² 添加普通账户
# useradd iflytek
# passwd XXX
(二) OpenSSL升级
# tar zxvf openssl-1.0.2k.tar.gz
# cd openssl-1.0.2k
# ./config shared -fPIC
# make && make install
# echo "/usr/local/ssl/lib " >> /etc/ld.so.conf
# ldconfig
# rm -rf /usr/bin/openssl
# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
# openssl version
(三) OpenSSH升级
使用命令“telnet IP”远程连接服务器,关闭SSH服务以便升级。
# 停止sshd服务
# service sshd stop
# apt安装libpam0g-dev
# apt-get install libpam0g-dev # 缺少libpam0g-dev会报错
# 删除原ssh中的相关配置文件
# rm -rf /etc/ssh /usr/bin/scp /usr/bin/sftp /usr/bin/ssh* /usr/sbin/sshd
# rm -rf /lib/x86_64-linux-gnu/libssl.so.1.0.0
# rm -rf /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
# cp /usr/local/ssl/lib/libssl.so.1.0.0 /lib/x86_64-linux-gnu/
# cp /usr/local/ssl/lib/libcrypto.so.1.0.0 /lib/x86_64-linux-gnu/
# 解压新版openssh并编译安装
# tar zxvf openssh-7.4p1.tar.gz
# cd openssh-7.4p1
# ./configure --prefix=/usr/local/ssh --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-ssl-dir=/usr/local/ssl --mandir=/usr/share/man --with-zlib=/usr/local/lib --with-privsep-path=/var/empty --with-privsep-user=sshd --with-ssl-engine
# make && make install
如果遇到这个错误,说明pam没装,需要装下:apt-get install pam
# 创建新版ssh服务的相关软链接
# ln -s /usr/local/ssh/bin/ssh /usr/bin/ssh
# ln -s /usr/local/ssh/bin/scp /usr/bin/scp
# ln -s /usr/local/ssh/bin/sftp /usr/bin/sftp
# ln -s /usr/local/ssh/bin/ssh-add /usr/bin/ssh-add
# ln -s /usr/local/ssh/bin/ssh-agent /usr/bin/ssh-agent
# ln -s /usr/local/ssh/bin/ssh-keygen /usr/bin/ssh-keygen
# ln -s /usr/local/ssh/bin/ssh-keyscan /usr/bin/ssh-keyscan
# ln -s /usr/local/ssh/sbin/sshd /usr/sbin/sshd
#配置允许root远程使用ssh登录(建议使用普通账号作为远程运维登录使用,不要开启root远程登录)
# vi /etc/ssh/sshd_config
去除“#PermitRootLogin prohibit-password”中注释,并修改“prohibit-password”为“yes”,最后保存退出;
# service sshd start
如果出错按照提示操作
# ssh -V
标签:user cal passwords 下载 开启 info font sshd_conf openssh
原文地址:https://www.cnblogs.com/mabiao008/p/12611481.html