当前位置:   article > 正文

ubuntu2204升级openssh_ubuntu22.4更新openssh9.7

ubuntu22.4更新openssh9.7

安装依赖

apt update
apt install build-essential zlib1g-dev libssl-dev -y
apt install libpam0g-dev libselinux1-dev libkrb5-dev -y

mkdir /var/lib/sshd
chmod -R 700 /var/lib/sshd/
chown -R root:sys /var/lib/sshd/

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

下载最新ssh

cd /var/lib/sshd/
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz
  • 1
  • 2

编辑安装

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/include/openssl --with-ssl-dir=/usr/local/lib --with-zlib --with-md5-passwords --with-pam --with-privsep-path=/var/lib/sshd
  • 1
make && make install
  • 1

修改配置

如果这里没有允许密码登录,又没有配置免密,那就gg了
根据自己需要调整sshd配置文件,参考如下

vim /etc/ssh/sshd_config
  • 1
PermitRootLogin yes                                    #允许root登录,root用户必须添加
AuthorizedKeysFile      .ssh/authorized_keys    #指定公钥文件的保存位置以及名称
PasswordAuthentication yes                             #允许密码验证
UsePAM yes                                                      #PAM模块
UseDNS no                                                        #关闭dns检测
  • 1
  • 2
  • 3
  • 4
  • 5

重启ssh

systemctl restart ssh
  • 1

检查版本

ssh -V
  • 1
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/980747
推荐阅读
相关标签
  

闽ICP备14008679号